summaryrefslogtreecommitdiffstats
path: root/sys/gnu
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2004-02-13 20:23:16 +0000
committerbde <bde@FreeBSD.org>2004-02-13 20:23:16 +0000
commit3a8e26fe33ba29f5a8dcc4d3480ae8c8427f42e3 (patch)
tree9370965da90b1090b784e1cff754d5fbd4af54e9 /sys/gnu
parent9edab9a14af41c1b801ef142a86f9437adc67db1 (diff)
downloadFreeBSD-src-3a8e26fe33ba29f5a8dcc4d3480ae8c8427f42e3.zip
FreeBSD-src-3a8e26fe33ba29f5a8dcc4d3480ae8c8427f42e3.tar.gz
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).
Diffstat (limited to 'sys/gnu')
-rw-r--r--sys/gnu/ext2fs/ext2_vfsops.c14
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vfsops.c14
2 files changed, 20 insertions, 8 deletions
diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c
index 17ca619..5687e43 100644
--- a/sys/gnu/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/ext2fs/ext2_vfsops.c
@@ -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
diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c
index 17ca619..5687e43 100644
--- a/sys/gnu/fs/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c
@@ -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
OpenPOWER on IntegriCloud