aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/vfs_default.c
diff options
context:
space:
mode:
authorJeff Roberson <jeff@FreeBSD.org>2006-03-31 03:52:24 +0000
committerJeff Roberson <jeff@FreeBSD.org>2006-03-31 03:52:24 +0000
commitc5fcce21c581f2c96e941e3dbfc4bb0a5212a4cd (patch)
tree1dfd6abf75b0ca4f6116ac125e0ee25c0e65269e /sys/kern/vfs_default.c
parenta218edceb2c1b61bc08673c7ae507f17db6c7090 (diff)
downloadsrc-c5fcce21c581f2c96e941e3dbfc4bb0a5212a4cd.tar.gz
src-c5fcce21c581f2c96e941e3dbfc4bb0a5212a4cd.zip
- 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.
Notes
Notes: svn path=/head/; revision=157323
Diffstat (limited to 'sys/kern/vfs_default.c')
-rw-r--r--sys/kern/vfs_default.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c
index 5f43685920fb..bf33115407ca 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);
}