MFffs (ffs_vfsops.c 1.76 (part of the big soft updates commit): lock

the vnode around calls to vinvalbuf()).  Apparently no one has tested
ext2fs with DEBUG_VOP_LOCKS.  Vnode locking for vinvalbuf() might not
be required in non-soft-updates cases, but it is now asserted.

MFffs (uncommitted related and nearby cleanups: don't unlock the vnode
after vinvalbuf() only to have to relock it almost immediately; don't
refer to devices classified by vn_isdisk() as block devices).
This commit is contained in:
Bruce Evans 2004-02-13 20:23:16 +00:00
parent 189a0ba4e7
commit 2211aa126a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=125786
2 changed files with 20 additions and 8 deletions

View File

@ -270,7 +270,7 @@ ext2_mount(mp, ndp, td)
}
/*
* Not an update, or updating the name: look up the name
* and verify that it refers to a sensible block device.
* and verify that it refers to a sensible disk device.
*/
if (fspec == NULL)
return (EINVAL);
@ -541,8 +541,11 @@ ext2_reload(mp, cred, td)
* Step 1: invalidate all cached meta-data.
*/
devvp = VFSTOEXT2(mp)->um_devvp;
if (vinvalbuf(devvp, 0, cred, td, 0, 0))
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
if (vinvalbuf(devvp, 0, cred, td, 0, 0) != 0)
panic("ext2_reload: dirty1");
VOP_UNLOCK(devvp, 0, td);
/*
* Step 2: re-read superblock from disk.
* constants have been adjusted for ext2
@ -646,15 +649,18 @@ ext2_mountfs(devvp, mp, td)
return (error);
if (vcount(devvp) > 1 && devvp != rootvp)
return (EBUSY);
if ((error = vinvalbuf(devvp, V_SAVE, td->td_ucred, td, 0, 0)) != 0)
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
error = vinvalbuf(devvp, V_SAVE, td->td_ucred, td, 0, 0);
if (error) {
VOP_UNLOCK(devvp, 0, td);
return (error);
}
#ifdef READONLY
/* turn on this to force it to be read-only */
mp->mnt_flag |= MNT_RDONLY;
#endif
ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
/*
* XXX: open the device with read and write access even if only
* read access is needed now. Write access is needed if the

View File

@ -270,7 +270,7 @@ ext2_mount(mp, ndp, td)
}
/*
* Not an update, or updating the name: look up the name
* and verify that it refers to a sensible block device.
* and verify that it refers to a sensible disk device.
*/
if (fspec == NULL)
return (EINVAL);
@ -541,8 +541,11 @@ ext2_reload(mp, cred, td)
* Step 1: invalidate all cached meta-data.
*/
devvp = VFSTOEXT2(mp)->um_devvp;
if (vinvalbuf(devvp, 0, cred, td, 0, 0))
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
if (vinvalbuf(devvp, 0, cred, td, 0, 0) != 0)
panic("ext2_reload: dirty1");
VOP_UNLOCK(devvp, 0, td);
/*
* Step 2: re-read superblock from disk.
* constants have been adjusted for ext2
@ -646,15 +649,18 @@ ext2_mountfs(devvp, mp, td)
return (error);
if (vcount(devvp) > 1 && devvp != rootvp)
return (EBUSY);
if ((error = vinvalbuf(devvp, V_SAVE, td->td_ucred, td, 0, 0)) != 0)
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
error = vinvalbuf(devvp, V_SAVE, td->td_ucred, td, 0, 0);
if (error) {
VOP_UNLOCK(devvp, 0, td);
return (error);
}
#ifdef READONLY
/* turn on this to force it to be read-only */
mp->mnt_flag |= MNT_RDONLY;
#endif
ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
/*
* XXX: open the device with read and write access even if only
* read access is needed now. Write access is needed if the