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:
parent
62eeeb8ff8
commit
8d041ea733
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user