ext4: don't save the error information if the block device is read-only
authorTheodore Ts'o <tytso@mit.edu>
Thu, 14 May 2015 22:37:30 +0000 (18:37 -0400)
committerMohamad Ayyash <mkayyash@google.com>
Thu, 21 May 2015 02:19:58 +0000 (19:19 -0700)
Google-Bug-Id: 20939131
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/super.c

index 48c8af5fe91d720c569dd06b67b9bac52f7d7bb7..fece245c796fef8f6b19efcb37a2c36f4263f026 100644 (file)
@@ -305,6 +305,8 @@ static void __save_error_info(struct super_block *sb, const char *func,
        struct ext4_super_block *es = EXT4_SB(sb)->s_es;
 
        EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
+       if (bdev_read_only(sb->s_bdev))
+               return;
        es->s_state |= cpu_to_le16(EXT4_ERROR_FS);
        es->s_last_error_time = cpu_to_le32(get_seconds());
        strncpy(es->s_last_error_func, func, sizeof(es->s_last_error_func));