From a8f48a95619cbce8f85423480e7d0a1bf971a62b Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Wed, 6 Dec 2006 20:40:13 -0800 Subject: [PATCH] ext3/4: don't do orphan processing on readonly devices If you do something like: # touch foo # tail -f foo & # rm foo # # 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 Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/ext4/super.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'fs/ext4/super.c') diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 2ede7e2c7019..486a641ca71b 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1321,6 +1321,12 @@ static void ext4_orphan_cleanup (struct super_block * sb, 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, " -- cgit v1.2.3-59-g8ed1b