summaryrefslogtreecommitdiffstats
path: root/sys/gnu/ext2fs/ext2_vfsops.c
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1997-08-04 05:10:31 +0000
committerdyson <dyson@FreeBSD.org>1997-08-04 05:10:31 +0000
commitec0474c458fa4162bdea016821c68694840ce909 (patch)
tree460f71c900f27e7ad0d39327671ffc14c15b95cf /sys/gnu/ext2fs/ext2_vfsops.c
parent17f776e5506226b7d23df2e9e363af9203813a2c (diff)
downloadFreeBSD-src-ec0474c458fa4162bdea016821c68694840ce909.zip
FreeBSD-src-ec0474c458fa4162bdea016821c68694840ce909.tar.gz
Fix a problem with ext2fs so that filesystems mounted at reboot don't
keep ahold of buffers, and therefore leave filesystems dirty. I haven't been able to test, but the code compiles. Those who run -current, please test and report back!!! (Sorry :-)). PR: kern/3571 Submitted by: Dirk Keunecke <dk@panda.rhein-main.de>
Diffstat (limited to 'sys/gnu/ext2fs/ext2_vfsops.c')
-rw-r--r--sys/gnu/ext2fs/ext2_vfsops.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c
index b56ed97..253d0e5 100644
--- a/sys/gnu/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/ext2fs/ext2_vfsops.c
@@ -412,10 +412,12 @@ static int compute_sb_data(devvp, es, fs)
printf("EXT2-fs: unable to read group descriptors (%d)\n", error);
return EIO;
}
+ /* Set the B_LOCKED flag on the buffer, then brelse() it */
+ LCK_BUF(fs->s_group_desc[i])
}
if(!ext2_check_descriptors(fs)) {
for (j = 0; j < db_count; j++)
- brelse(fs->s_group_desc[j]);
+ ULCK_BUF(fs->s_group_desc[j])
bsd_free(fs->s_group_desc, M_UFSMNT);
printf("EXT2-fs: (ext2_check_descriptors failure) "
"unable to read group descriptors\n");
@@ -691,16 +693,19 @@ ext2_unmount(mp, mntflags, p)
fs->s_es->s_state |= EXT2_VALID_FS; /* was fs_clean = 1 */
ext2_sbupdate(ump, MNT_WAIT);
}
+
/* release buffers containing group descriptors */
for(i = 0; i < fs->s_db_per_group; i++)
- brelse(fs->s_group_desc[i]);
+ ULCK_BUF(fs->s_group_desc[i])
+
/* release cached inode/block bitmaps */
for (i = 0; i < EXT2_MAX_GROUP_LOADED; i++)
if (fs->s_inode_bitmap[i])
- brelse (fs->s_inode_bitmap[i]);
+ ULCK_BUF(fs->s_inode_bitmap[i])
+
for (i = 0; i < EXT2_MAX_GROUP_LOADED; i++)
if (fs->s_block_bitmap[i])
- brelse (fs->s_block_bitmap[i]);
+ ULCK_BUF(fs->s_block_bitmap[i])
ump->um_devvp->v_specflags &= ~SI_MOUNTEDON;
error = VOP_CLOSE(ump->um_devvp, ronly ? FREAD : FREAD|FWRITE,
@@ -1106,20 +1111,11 @@ printf("\nupdating superblock, waitfor=%s\n", waitfor == MNT_WAIT ? "yes":"no");
else
bawrite(bp);
- /* write group descriptors back on disk */
- for(i = 0; i < fs->s_db_per_group; i++)
- /* Godmar thinks: we must avoid using any of the b*write
- * functions here: we want to keep the buffer locked
- * so we use my 'housemade' write routine:
+ /*
+ * The buffers for group descriptors, inode bitmaps and block bitmaps
+ * are not busy at this point and are (hopefully) written by the
+ * usual sync mechanism. No need to write them here
*/
- error |= ll_w_block(fs->s_group_desc[i], waitfor == MNT_WAIT);
-
- for (i = 0; i < EXT2_MAX_GROUP_LOADED; i++)
- if (fs->s_inode_bitmap[i])
- ll_w_block (fs->s_inode_bitmap[i], 1);
- for (i = 0; i < EXT2_MAX_GROUP_LOADED; i++)
- if (fs->s_block_bitmap[i])
- ll_w_block (fs->s_block_bitmap[i], 1);
return (error);
}
OpenPOWER on IntegriCloud