MFC r297513: remove emulation of VFS_HOLD and VFS_RELE from opensolaris compat

This commit is contained in:
avg 2016-04-24 08:39:55 +00:00
parent e208d209fe
commit 9346083f1b
4 changed files with 39 additions and 13 deletions

View File

@ -54,17 +54,6 @@ typedef struct mount vfs_t;
#define VFS_NOSETUID MNT_NOSUID
#define VFS_NOEXEC MNT_NOEXEC
#define VFS_HOLD(vfsp) do { \
MNT_ILOCK(vfsp); \
MNT_REF(vfsp); \
MNT_IUNLOCK(vfsp); \
} while (0)
#define VFS_RELE(vfsp) do { \
MNT_ILOCK(vfsp); \
MNT_REL(vfsp); \
MNT_IUNLOCK(vfsp); \
} while (0)
#define fs_vscan(vp, cr, async) (0)
#define VROOT VV_ROOT

View File

@ -589,7 +589,9 @@ gfs_root_create(size_t size, vfs_t *vfsp, vnodeops_t *ops, ino64_t ino,
{
vnode_t *vp;
#ifdef illumos
VFS_HOLD(vfsp);
#endif
vp = gfs_dir_create(size, NULL, vfsp, ops, entries, inode_cb,
maxlen, readdir_cb, lookup_cb);
/* Manually set the inode */
@ -700,7 +702,9 @@ found:
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
} else {
ASSERT(vp->v_vfsp != NULL);
#ifdef illumos
VFS_RELE(vp->v_vfsp);
#endif
}
#ifdef TODO
if (vp->v_flag & V_XATTRDIR)

View File

@ -1442,7 +1442,14 @@ getzfsvfs(const char *dsname, zfsvfs_t **zfvp)
mutex_enter(&os->os_user_ptr_lock);
*zfvp = dmu_objset_get_user(os);
if (*zfvp) {
#ifdef illumos
VFS_HOLD((*zfvp)->z_vfs);
#else
if (vfs_busy((*zfvp)->z_vfs, 0) != 0) {
*zfvp = NULL;
error = SET_ERROR(ESRCH);
}
#endif
} else {
error = SET_ERROR(ESRCH);
}
@ -1486,7 +1493,11 @@ zfsvfs_rele(zfsvfs_t *zfsvfs, void *tag)
rrm_exit(&zfsvfs->z_teardown_lock, tag);
if (zfsvfs->z_vfs) {
#ifdef illumos
VFS_RELE(zfsvfs->z_vfs);
#else
vfs_unbusy(zfsvfs->z_vfs);
#endif
} else {
dmu_objset_disown(zfsvfs->z_os, zfsvfs);
zfsvfs_free(zfsvfs);
@ -3017,11 +3028,13 @@ zfs_get_vfs(const char *resource)
mtx_lock(&mountlist_mtx);
TAILQ_FOREACH(vfsp, &mountlist, mnt_list) {
if (strcmp(refstr_value(vfsp->vfs_resource), resource) == 0) {
VFS_HOLD(vfsp);
if (vfs_busy(vfsp, MBF_MNTLSTLOCK) != 0)
vfsp = NULL;
break;
}
}
mtx_unlock(&mountlist_mtx);
if (vfsp == NULL)
mtx_unlock(&mountlist_mtx);
return (vfsp);
}
@ -3474,7 +3487,11 @@ zfs_unmount_snap(const char *snapname)
ASSERT(!dsl_pool_config_held(dmu_objset_pool(zfsvfs->z_os)));
err = vn_vfswlock(vfsp->vfs_vnodecovered);
#ifdef illumos
VFS_RELE(vfsp);
#else
vfs_unbusy(vfsp);
#endif
if (err != 0)
return (SET_ERROR(err));
@ -3720,7 +3737,11 @@ zfs_ioc_rollback(const char *fsname, nvlist_t *args, nvlist_t *outnvl)
resume_err = zfs_resume_fs(zfsvfs, fsname);
error = error ? error : resume_err;
}
#ifdef illumos
VFS_RELE(zfsvfs->z_vfs);
#else
vfs_unbusy(zfsvfs->z_vfs);
#endif
} else {
error = dsl_dataset_rollback(fsname, NULL, outnvl);
}
@ -4375,7 +4396,11 @@ zfs_ioc_recv(zfs_cmd_t *zc)
if (error == 0)
error = zfs_resume_fs(zfsvfs, tofs);
error = error ? error : end_err;
#ifdef illumos
VFS_RELE(zfsvfs->z_vfs);
#else
vfs_unbusy(zfsvfs->z_vfs);
#endif
} else {
error = dmu_recv_end(&drc, NULL);
}
@ -4924,7 +4949,11 @@ zfs_ioc_userspace_upgrade(zfs_cmd_t *zc)
}
if (error == 0)
error = dmu_objset_userspace_upgrade(zfsvfs->z_os);
#ifdef illumos
VFS_RELE(zfsvfs->z_vfs);
#else
vfs_unbusy(zfsvfs->z_vfs);
#endif
} else {
/* XXX kind of reading contents without owning */
error = dmu_objset_hold(zc->zc_name, FTAG, &os);

View File

@ -743,7 +743,9 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz,
if (vp->v_type != VFIFO)
VN_LOCK_ASHARE(vp);
#ifdef illumos
VFS_HOLD(zfsvfs->z_vfs);
#endif
return (zp);
}
@ -1428,7 +1430,9 @@ zfs_znode_free(znode_t *zp)
kmem_cache_free(znode_cache, zp);
#ifdef illumos
VFS_RELE(zfsvfs->z_vfs);
#endif
}
void