Răsfoiți Sursa

ext4: don't save the error information if the block device is read-only

Google-Bug-Id: 20939131
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o 10 ani în urmă
părinte
comite
1b46617b8d
1 a modificat fișierele cu 2 adăugiri și 0 ștergeri
  1. 2 0
      fs/ext4/super.c

+ 2 - 0
fs/ext4/super.c

@@ -294,6 +294,8 @@ static void __save_error_info(struct super_block *sb, const char *func,
 	struct ext4_super_block *es = EXT4_SB(sb)->s_es;
 	struct ext4_super_block *es = EXT4_SB(sb)->s_es;
 
 
 	EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
 	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_state |= cpu_to_le16(EXT4_ERROR_FS);
 	es->s_last_error_time = cpu_to_le32(get_seconds());
 	es->s_last_error_time = cpu_to_le32(get_seconds());
 	strncpy(es->s_last_error_func, func, sizeof(es->s_last_error_func));
 	strncpy(es->s_last_error_func, func, sizeof(es->s_last_error_func));