- GETWRITEMOUNT now returns a referenced mountpoint to prevent its

identity from changing.  This is possible now that mounts are not freed.

Discussed with:	tegge
Tested by:	kris
Sponsored by:	Isilon Systems, Inc.
This commit is contained in:
jeff 2006-03-31 03:52:24 +00:00
parent 1a43943ef6
commit d018a9a820

View File

@ -343,8 +343,22 @@ vop_stdgetwritemount(ap)
struct mount **a_mpp; struct mount **a_mpp;
} */ *ap; } */ *ap;
{ {
struct mount *mp;
*(ap->a_mpp) = ap->a_vp->v_mount; /*
* XXX Since this is called unlocked we may be recycled while
* attempting to ref the mount. If this is the case or mountpoint
* will be set to NULL. We only have to prevent this call from
* returning with a ref to an incorrect mountpoint. It is not
* harmful to return with a ref to our previous mountpoint.
*/
mp = ap->a_vp->v_mount;
vfs_ref(mp);
if (mp != ap->a_vp->v_mount) {
vfs_rel(mp);
mp = NULL;
}
*(ap->a_mpp) = mp;
return (0); return (0);
} }