[patch] fix the ext3 data=journal unmount bug
Ken Moffat
kmoffat
Mon May 17 11:41:16 PDT 2004
Here's mine:
/usr/src/linux/fs/ext3/super.c.rej
***************
*** 47,54 ****
static void ext3_clear_journal_err(struct super_block * sb,
struct ext3_super_block * es);
- static int ext3_sync_fs(struct super_block * sb);
-
#ifdef CONFIG_JBD_DEBUG
int journal_no_write[2];
--- 47,52 ----
static void ext3_clear_journal_err(struct super_block * sb,
struct ext3_super_block * es);
#ifdef CONFIG_JBD_DEBUG
int journal_no_write[2];
***************
*** 456,462 ****
delete_inode: ext3_delete_inode, /* BKL not held. We take it */
put_super: ext3_put_super, /* BKL held */
write_super: ext3_write_super, /* BKL held */
- sync_fs: ext3_sync_fs,
write_super_lockfs: ext3_write_super_lockfs, /* BKL not held. Take
it */
unlockfs: ext3_unlockfs, /* BKL not held. We take it */
statfs: ext3_statfs, /* BKL held */
--- 454,459 ----
delete_inode: ext3_delete_inode, /* BKL not held. We take it */
put_super: ext3_put_super, /* BKL held */
write_super: ext3_write_super, /* BKL held */
write_super_lockfs: ext3_write_super_lockfs, /* BKL not held. Take
it */
unlockfs: ext3_unlockfs, /* BKL not held. We take it */
statfs: ext3_statfs, /* BKL held */
***************
*** 1580,1601 ****
* This implicitly triggers the writebehind on sync().
*/
void ext3_write_super (struct super_block * sb)
{
- if (down_trylock(&sb->s_lock) == 0)
- BUG();
- sb->s_dirt = 0;
- log_start_commit(EXT3_SB(sb)->s_journal, NULL);
- }
-
- static int ext3_sync_fs(struct super_block *sb)
- {
tid_t target;
sb->s_dirt = 0;
target = log_start_commit(EXT3_SB(sb)->s_journal, NULL);
- log_wait_commit(EXT3_SB(sb)->s_journal, target);
- return 0;
}
/*
--- 1577,1600 ----
* This implicitly triggers the writebehind on sync().
*/
+ static int do_sync_supers = 0;
+ MODULE_PARM(do_sync_supers, "i");
+ MODULE_PARM_DESC(do_sync_supers, "Write superblocks synchronously");
+
void ext3_write_super (struct super_block * sb)
{
tid_t target;
+ if (down_trylock(&sb->s_lock) == 0)
+ BUG(); /* aviro detector */
sb->s_dirt = 0;
target = log_start_commit(EXT3_SB(sb)->s_journal, NULL);
+
+ if (do_sync_supers) {
+ unlock_super(sb);
+ log_wait_commit(EXT3_SB(sb)->s_journal, target);
+ lock_super(sb);
+ }
}
/*
--
Ken Moffat
kmoffat at drizzle.com
More information about the Linux-users
mailing list