From 31d710a7bd42f0d89e30d53bdaad427c5f191d0d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Maciej=20=C5=BBenczykowski?= Date: Sun, 26 Sep 2010 12:38:28 +0000 Subject: [PATCH] ext3: don't update sb journal_devnum when RO dev MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit An ext3 filesystem on a read-only device, with an external journal which is at a different device number then recorded in the superblock will fail to honor the read-only setting of the device and trigger a superblock update (write). For example: - ext3 on a software raid which is in read-only mode - external journal on a read-write device which has changed device num - attempt to mount with -o journal_dev= - hits BUG_ON(mddev->ro = 1) in md.c Cc: Theodore Ts'o Signed-off-by: Maciej Żenczykowski Signed-off-by: Jan Kara --- fs/ext3/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext3/super.c b/fs/ext3/super.c index acf8695fa8f..04169318e6b 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c @@ -2290,7 +2290,7 @@ static int ext3_load_journal(struct super_block *sb, EXT3_SB(sb)->s_journal = journal; ext3_clear_journal_err(sb, es); - if (journal_devnum && + if (!really_read_only && journal_devnum && journal_devnum != le32_to_cpu(es->s_journal_dev)) { es->s_journal_dev = cpu_to_le32(journal_devnum); -- 2.39.5