aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2015-05-14 18:37:30 -0400
committerMister Oyster <oysterized@gmail.com>2017-12-31 01:44:57 +0100
commit3b0b4383c22b74c182fc843a5f61b0dc90fbe238 (patch)
tree230f37bedfbf391ee327c2753d3bc871982a3c2d
parent19c5c39c8147bdba0b662df8df9cc7bbc35df07e (diff)
ext4: don't save the error information if the block device is read-only
.... because otherwise a corrupted root file file system (caused by flash corruption, etc.) will result in the device becoming bricked after an attempted OTA update --- which can only be recovered by a custom recovery image manually flashed onto the device (or a warantee return). Cherry picked from android-common 3.10 branch: 00a6e4dfa BUG=20939131 Change-Id: I7d5fe852c30efc35aa39fba7f708a22c034a1839 Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: "Theodore Ts'o" <tytso@google.com>
-rw-r--r--fs/ext4/super.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index c0285908b..8645c4346 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -299,6 +299,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));