Changeset View
Changeset View
Standalone View
Standalone View
head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c
Show First 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | if (error == 0) { | ||||
else | else | ||||
error = EBUSY; | error = EBUSY; | ||||
VI_UNLOCK(vp); | VI_UNLOCK(vp); | ||||
} | } | ||||
if (error != 0) { | if (error != 0) { | ||||
vput(vp); | vput(vp); | ||||
return (error); | return (error); | ||||
} | } | ||||
vn_seqc_write_begin(vp); | |||||
VOP_UNLOCK(vp); | VOP_UNLOCK(vp); | ||||
/* | /* | ||||
* Allocate and initialize the filesystem. | * Allocate and initialize the filesystem. | ||||
* We don't want regular user that triggered snapshot mount to be able | * We don't want regular user that triggered snapshot mount to be able | ||||
* to unmount it, so pass credentials of the parent mount. | * to unmount it, so pass credentials of the parent mount. | ||||
*/ | */ | ||||
mp = vfs_mount_alloc(vp, vfsp, fspath, vp->v_mount->mnt_cred); | mp = vfs_mount_alloc(vp, vfsp, fspath, vp->v_mount->mnt_cred); | ||||
Show All 36 Lines | if (error != 0) { | ||||
* under the vnode lock. This is not strictly required, | * under the vnode lock. This is not strictly required, | ||||
* but makes it easier to reason about the life-cycle and | * but makes it easier to reason about the life-cycle and | ||||
* ownership of the covered vnode. | * ownership of the covered vnode. | ||||
*/ | */ | ||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); | vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); | ||||
VI_LOCK(vp); | VI_LOCK(vp); | ||||
vp->v_iflag &= ~VI_MOUNT; | vp->v_iflag &= ~VI_MOUNT; | ||||
VI_UNLOCK(vp); | VI_UNLOCK(vp); | ||||
vn_seqc_write_end(vp); | |||||
vput(vp); | vput(vp); | ||||
vfs_unbusy(mp); | vfs_unbusy(mp); | ||||
vfs_freeopts(mp->mnt_optnew); | vfs_freeopts(mp->mnt_optnew); | ||||
mp->mnt_vnodecovered = NULL; | mp->mnt_vnodecovered = NULL; | ||||
vfs_mount_destroy(mp); | vfs_mount_destroy(mp); | ||||
return (error); | return (error); | ||||
} | } | ||||
Show All 19 Lines | #endif | ||||
vp->v_mountedhere = mp; | vp->v_mountedhere = mp; | ||||
/* Put the new filesystem on the mount list. */ | /* Put the new filesystem on the mount list. */ | ||||
mtx_lock(&mountlist_mtx); | mtx_lock(&mountlist_mtx); | ||||
TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list); | TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list); | ||||
mtx_unlock(&mountlist_mtx); | mtx_unlock(&mountlist_mtx); | ||||
vfs_event_signal(NULL, VQ_MOUNT, 0); | vfs_event_signal(NULL, VQ_MOUNT, 0); | ||||
if (VFS_ROOT(mp, LK_EXCLUSIVE, &mvp)) | if (VFS_ROOT(mp, LK_EXCLUSIVE, &mvp)) | ||||
panic("mount: lost mount"); | panic("mount: lost mount"); | ||||
vn_seqc_write_end(vp); | |||||
VOP_UNLOCK(vp); | VOP_UNLOCK(vp); | ||||
vfs_op_exit(mp); | vfs_op_exit(mp); | ||||
vfs_unbusy(mp); | vfs_unbusy(mp); | ||||
*vpp = mvp; | *vpp = mvp; | ||||
return (0); | return (0); | ||||
} | } |