aboutsummaryrefslogtreecommitdiff
path: root/sys/gnu/fs/xfs
diff options
context:
space:
mode:
authorAttilio Rao <attilio@FreeBSD.org>2008-07-21 23:01:09 +0000
committerAttilio Rao <attilio@FreeBSD.org>2008-07-21 23:01:09 +0000
commit09400d5abe7b07993d6e778050891a31b9dc0915 (patch)
tree3a777195e2dc99a447ae78c9fafb25b15188b6ee /sys/gnu/fs/xfs
parentc7971a92eab20900c25dc792bb66f762aed38065 (diff)
downloadsrc-09400d5abe7b07993d6e778050891a31b9dc0915.tar.gz
src-09400d5abe7b07993d6e778050891a31b9dc0915.zip
- Disallow XFS mounting in write mode. The write support never worked really
and there is no need to maintain it. - Fix vn_get() in order to let it call vget(9) with a valid locking request. vget(9) returns the vnode locked in order to prevent recycling, but in this case internal XFS locks alredy prevent it from happening, so it is safe to drop the vnode lock before to return by vn_get(). - Add a VNASSERT() in vget(9) in order to catch malformed locking requests. Discussed with: kan, kib Tested by: Lothar Braun <lothar at lobraun dot de>
Notes
Notes: svn path=/head/; revision=180682
Diffstat (limited to 'sys/gnu/fs/xfs')
-rw-r--r--sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c2
-rw-r--r--sys/gnu/fs/xfs/FreeBSD/xfs_vnode.c15
2 files changed, 12 insertions, 5 deletions
diff --git a/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c b/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c
index 244ad3099e84..ea815b21e74e 100644
--- a/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c
+++ b/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c
@@ -199,6 +199,8 @@ _xfs_mount(struct mount *mp,
if (mp->mnt_flag & MNT_UPDATE)
return (0);
+ if ((mp->mnt_flag & MNT_RDONLY) == 0)
+ return (EPERM);
xmp = xfsmount_allocate(mp);
if (xmp == NULL)
diff --git a/sys/gnu/fs/xfs/FreeBSD/xfs_vnode.c b/sys/gnu/fs/xfs/FreeBSD/xfs_vnode.c
index 8e2b1f97274a..3b3f3e5b4916 100644
--- a/sys/gnu/fs/xfs/FreeBSD/xfs_vnode.c
+++ b/sys/gnu/fs/xfs/FreeBSD/xfs_vnode.c
@@ -104,13 +104,18 @@ vn_get(
vp = vmap->v_vp;
- error = vget(vp, 0, curthread);
- if (error) {
- vdrop(vp);
+ error = vget(vp, LK_EXCLUSIVE, curthread);
+ vdrop(vp);
+ if (error)
return (NULL);
- }
- vdrop(vp);
+ /*
+ * Drop the vnode returned by vget here.
+ * VOP_RECLAIM(9) should block on internal XFS locks so that
+ * the reclaiming scheme still remains consistent even if the
+ * vp is not locked.
+ */
+ VOP_UNLOCK(vp, 0);
if (vp->v_data != xfs_vp) {
vput(vp);
return (NULL);