ext4: don't save the error information if the block device is read-only
Theodore Ts'o
maintainerPATCH 1/1 ext4: don't save the error information if the block device is read-only
Google-Bug-Id: 20939131
--- fs/ext4/super.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ext4/super.c +2 -0
@@ -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;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));
Signature · 1 line
2.3.0
A message that is not in the archive (sent off-list or not yet received): CAG_9a6cSd-1VDD8zkCt7zFPbBi01a78VeOTDyi0NJuvS26XApw@mail.gmail.com
Theodore Ts'o
maintainerQuoted 2 lines · Mohamad Ayyash
I wonder if there should be some similar protection at other callers of
ext4_commit_superlikeext4_mark_recovery_complete?
We do have protections already before we start replaying the journal, and before we process the orphaned inode list. See the bdev_read_only() calls in ext4_orphan_cleanup() and ext4_load_journal().
So I think we have them all covered, but let me know if you find one that we've missed. Something that's probably worth doing is to putting in a debugging patch that notices when thre are writes sent down from the file systems when the block device is marked read-only, and then running xfstests and seeing if it trips anywhere.
Cheers,
- Ted