diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 695010d1da0a..09fc8f3c3160 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -543,6 +543,7 @@ do_sys_mount(struct lwp *l, const char *type, enum uio_seg type_seg, { struct vfsops *vfsops = NULL; /* XXX gcc4.8 */ struct vnode *vp; + struct mount *mp; void *data_buf = data; bool vfsopsrele = false; size_t alloc_sz = 0; @@ -554,8 +555,11 @@ do_sys_mount(struct lwp *l, const char *type, enum uio_seg type_seg, error = namei_simple_user(path, NSM_FOLLOW_TRYEMULROOT, &vp); if (error != 0) { vp = NULL; + mp = NULL; goto done; } + mp = vp->v_mount; + fstrans_start(mp); if (flags & (MNT_GETARGS | MNT_UPDATE)) { vfsops = vp->v_mount->mnt_op; @@ -626,6 +630,8 @@ do_sys_mount(struct lwp *l, const char *type, enum uio_seg type_seg, done: if (vfsopsrele) vfs_delref(vfsops); + if (mp) + fstrans_done(mp); if (vp != NULL) { vrele(vp); }