Changeset View
Changeset View
Standalone View
Standalone View
sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c
Show First 20 Lines • Show All 190 Lines • ▼ Show 20 Lines | mount_snapshot(kthread_t *td, vnode_t **vpp, const char *fstype, char *fspath, | ||||
* XXX: Is is safe when snapshot is mounted from within a jail? | * XXX: Is is safe when snapshot is mounted from within a jail? | ||||
*/ | */ | ||||
cr = td->td_ucred; | cr = td->td_ucred; | ||||
td->td_ucred = kcred; | td->td_ucred = kcred; | ||||
error = VFS_MOUNT(mp); | error = VFS_MOUNT(mp); | ||||
td->td_ucred = cr; | td->td_ucred = cr; | ||||
if (error != 0) { | if (error != 0) { | ||||
/* | |||||
* Clear VI_MOUNT and decrement the use count "atomically", | |||||
* under the vnode lock. This is not strictly required, | |||||
* but makes it easier to reason about the life-cycle and | |||||
* ownership of the covered vnode. | |||||
*/ | |||||
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); | ||||
vrele(vp); | vput(vp); | ||||
vfs_unbusy(mp); | vfs_unbusy(mp); | ||||
vfs_freeopts(mp->mnt_optnew); | vfs_freeopts(mp->mnt_optnew); | ||||
vfs_mount_destroy(mp); | vfs_mount_destroy(mp); | ||||
return (error); | return (error); | ||||
} | } | ||||
if (mp->mnt_opt != NULL) | if (mp->mnt_opt != NULL) | ||||
vfs_freeopts(mp->mnt_opt); | vfs_freeopts(mp->mnt_opt); | ||||
Show All 30 Lines |