- 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>
This commit is contained in:
parent
c7971a92ea
commit
09400d5abe
@ -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)
|
||||
|
@ -104,13 +104,18 @@ vn_get(
|
||||
|
||||
vp = vmap->v_vp;
|
||||
|
||||
error = vget(vp, 0, curthread);
|
||||
if (error) {
|
||||
vdrop(vp);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
error = vget(vp, LK_EXCLUSIVE, curthread);
|
||||
vdrop(vp);
|
||||
if (error)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
@ -2038,6 +2038,8 @@ vget(struct vnode *vp, int flags, struct thread *td)
|
||||
|
||||
error = 0;
|
||||
VFS_ASSERT_GIANT(vp->v_mount);
|
||||
VNASSERT((flags & LK_TYPE_MASK) != 0, vp,
|
||||
("vget: invalid lock operation"));
|
||||
if ((flags & LK_INTERLOCK) == 0)
|
||||
VI_LOCK(vp);
|
||||
vholdl(vp);
|
||||
|
Loading…
Reference in New Issue
Block a user