From d018a9a82031a9c4b99602056e747592e74b6b80 Mon Sep 17 00:00:00 2001 From: jeff Date: Fri, 31 Mar 2006 03:52:24 +0000 Subject: - 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. --- sys/kern/vfs_default.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'sys/kern/vfs_default.c') diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 5f43685..bf33115 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -343,8 +343,22 @@ vop_stdgetwritemount(ap) struct mount **a_mpp; } */ *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); } -- cgit v1.1