From a99aaff64500e19e2704af159fb1a2eb98903a64 Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Sat, 26 Sep 2009 00:07:14 +0000 Subject: [PATCH] Use traverse() function to find and return mount point's vnode instead of covered vnode when snapshot is already mounted. MFC after: 3 days --- .../contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c index 0b034f627ceb..cdc3774026e2 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c @@ -818,7 +818,11 @@ zfsctl_snapdir_lookup(ap) if ((sep = avl_find(&sdp->sd_snaps, &search, &where)) != NULL) { *vpp = sep->se_root; VN_HOLD(*vpp); - if ((*vpp)->v_mountedhere == NULL) { + err = traverse(vpp, LK_EXCLUSIVE | LK_RETRY); + if (err) { + VN_RELE(*vpp); + *vpp = NULL; + } else if (*vpp == sep->se_root) { /* * The snapshot was unmounted behind our backs, * try to remount it. @@ -832,10 +836,9 @@ zfsctl_snapdir_lookup(ap) */ (*vpp)->v_flag &= ~VROOT; } - vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); mutex_exit(&sdp->sd_lock); ZFS_EXIT(zfsvfs); - return (0); + return (err); } /*