提交 a8f48a95 编写于 作者: E Eric Sandeen 提交者: Linus Torvalds

[PATCH] ext3/4: don't do orphan processing on readonly devices

If you do something like:

  # touch foo
  # tail -f foo &
  # rm foo
  # <take snapshot>
  # <mount snapshot>

you'll panic, because ext3/4 tries to do orphan list processing on the
readonly snapshot device, and:

  kernel: journal commit I/O error
  kernel: Assertion failure in journal_flush_Rsmp_e2f189ce() at journal.c:1356: "!journal->j_checkpoint_transactions"
  kernel: Kernel panic: Fatal exception

for a truly readonly underlying device, it's reasonable and necessary
to just skip orphan list processing.
Signed-off-by: NEric Sandeen <sandeen@redhat.com>
Cc: <linux-ext4@vger.kernel.org>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 a0e7688d
...@@ -1264,6 +1264,12 @@ static void ext3_orphan_cleanup (struct super_block * sb, ...@@ -1264,6 +1264,12 @@ static void ext3_orphan_cleanup (struct super_block * sb,
return; return;
} }
if (bdev_read_only(sb->s_bdev)) {
printk(KERN_ERR "EXT3-fs: write access "
"unavailable, skipping orphan cleanup.\n");
return;
}
if (EXT3_SB(sb)->s_mount_state & EXT3_ERROR_FS) { if (EXT3_SB(sb)->s_mount_state & EXT3_ERROR_FS) {
if (es->s_last_orphan) if (es->s_last_orphan)
jbd_debug(1, "Errors on filesystem, " jbd_debug(1, "Errors on filesystem, "
......
...@@ -1321,6 +1321,12 @@ static void ext4_orphan_cleanup (struct super_block * sb, ...@@ -1321,6 +1321,12 @@ static void ext4_orphan_cleanup (struct super_block * sb,
return; return;
} }
if (bdev_read_only(sb->s_bdev)) {
printk(KERN_ERR "EXT4-fs: write access "
"unavailable, skipping orphan cleanup.\n");
return;
}
if (EXT4_SB(sb)->s_mount_state & EXT4_ERROR_FS) { if (EXT4_SB(sb)->s_mount_state & EXT4_ERROR_FS) {
if (es->s_last_orphan) if (es->s_last_orphan)
jbd_debug(1, "Errors on filesystem, " jbd_debug(1, "Errors on filesystem, "
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册