mutex_enter(&os->os_user_ptr_lock);
*zsbp = dmu_objset_get_user(os);
- if (*zsbp) {
- mntget((*zsbp)->z_vfs);
+ if (*zsbp && (*zsbp)->z_sb) {
+ if (atomic_inc_not_zero(&((*zsbp)->z_sb->s_active)))
+ error = ESRCH;
} else {
error = ESRCH;
}
/*
* Find a zfs_sb_t for a mounted filesystem, or create our own, in which
- * case its z_vfs will be NULL, and it will be opened as the owner.
+ * case its z_sb will be NULL, and it will be opened as the owner.
*/
static int
zfs_sb_hold(const char *name, void *tag, zfs_sb_t **zsbp, boolean_t writer)
{
rrw_exit(&zsb->z_teardown_lock, tag);
- if (zsb->z_vfs) {
- mntput(zsb->z_vfs);
+ if (zsb->z_sb) {
+ deactivate_super(zsb->z_sb);
} else {
dmu_objset_disown(zsb->z_os, zsb);
zfs_sb_free(zsb);
resume_err = zfs_resume_fs(zsb, zc->zc_name);
error = error ? error : resume_err;
}
- mntput(zsb->z_vfs);
+ deactivate_super(zsb->z_sb);
} else {
if (dsl_dataset_tryown(ds, B_FALSE, FTAG)) {
error = dsl_dataset_clone_swap(clone, ds, B_TRUE);
if (error == 0)
error = zfs_resume_fs(zsb, tofs);
error = error ? error : end_err;
- mntput(zsb->z_vfs);
+ deactivate_super(zsb->z_sb);
} else {
error = dmu_recv_end(&drc);
}
}
if (error == 0)
error = dmu_objset_userspace_upgrade(zsb->z_os);
- mntput(zsb->z_vfs);
+ deactivate_super(zsb->z_sb);
} else {
/* XXX kind of reading contents without owning */
error = dmu_objset_hold(zc->zc_name, FTAG, &os);