[PATCH] 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: Eric Sandeen <sandeen@xxxxxxxxxx>

Index: linux-2.6.18/fs/ext3/super.c
===================================================================
--- linux-2.6.18.orig/fs/ext3/super.c
+++ linux-2.6.18/fs/ext3/super.c
@@ -1264,6 +1264,12 @@ static void ext3_orphan_cleanup (struct
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 (es->s_last_orphan)
jbd_debug(1, "Errors on filesystem, "
Index: linux-2.6.18/fs/ext4/super.c
===================================================================
--- linux-2.6.18.orig/fs/ext4/super.c
+++ linux-2.6.18/fs/ext4/super.c
@@ -1321,6 +1321,12 @@ static void ext4_orphan_cleanup (struct
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 (es->s_last_orphan)
jbd_debug(1, "Errors on filesystem, "


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: Back to the future.
    ... want the snapshot itself to be written. ... So the kernel has to be fully ... No need for userspace at all. ... *mount* a new filesystem for writing the snapshot image). ...
    (Linux-Kernel)
  • New mirror snapshot LVM setup planned, what do I need
    ... be able to backup the snapshot, not the active file system, and avoid some ... freeze the main filesystem to get a good snapshot, I don't want to freeze it ... Which kernel should I be using? ... file-system locking features that may or may not be supported in specific OS ...
    (comp.os.linux.setup)
  • Re: [PATCH] Remove process freezer from suspend to RAM pathway
    ... The freezer is one somewhat horrible way to get it working for now, I would prefer something more along the way that blocks the page cache from writing out new dirty pages though, except those specifically flagged by the snapshot. ... Userspace process sends SIGCONT to only those processes which are necessary for sync and a device-mapper snapshot. ... Kernel starts freeing memory and swapping stuff out to make room for a copy of *kernel* memory ...
    (Linux-Kernel)
  • Re: Crashing server but what could be wrong?
    ... The crash is always happening when a backup starts. ... Latest 2.4 kernel. ... it's the snapshot that is causing the crash. ... this is probably a kernel memory shortage anyway: ...
    (uk.comp.os.linux)
  • Re: RFC: Self-snapshotting in Linux
    ... Isn't that just what Ying Huans kexec-based hibernation does? ... My original starting point was VMWare's snapshot idea. ... kernel + userspace application. ... Assuming we have 32G of memory, ...
    (Linux-Kernel)