opensolaris_lookup: use vfs_busy in traverse before calling VFS_ROOT

... to ensure that we have a valid mountpoint during the call.

Reviewed by:	kib
MFC after:	19 days
This commit is contained in:
Andriy Gapon 2012-11-04 14:16:18 +00:00
parent 62eeeb8ff8
commit 8d041ea733
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=242569

View File

@ -88,6 +88,7 @@ traverse(vnode_t **cvpp, int lktype)
vfsp = vn_mountedvfs(cvp);
if (vfsp == NULL)
break;
error = vfs_busy(vfsp, 0);
/*
* tvp is NULL for *cvpp vnode, which we can't unlock.
*/
@ -95,12 +96,15 @@ traverse(vnode_t **cvpp, int lktype)
vput(cvp);
else
vrele(cvp);
if (error)
return (error);
/*
* The read lock must be held across the call to VFS_ROOT() to
* prevent a concurrent unmount from destroying the vfs.
*/
error = VFS_ROOT(vfsp, lktype, &tvp);
vfs_unbusy(vfsp);
if (error != 0)
return (error);
cvp = tvp;