Use traverse() function to find and return mount point's vnode instead of

covered vnode when snapshot is already mounted.

MFC after:	3 days
This commit is contained in:
Pawel Jakub Dawidek 2009-09-26 00:07:14 +00:00
parent 1aba32d9b4
commit a99aaff645

View File

@ -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);
}
/*