diff options
author | Theodore Ts'o <tytso@mit.edu> | 2018-12-30 23:20:39 -0500 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2019-04-04 16:14:09 +0100 |
commit | ca323c61656c51dd1c96233b178b58ba8aa6ca5b (patch) | |
tree | 42d90c23be888bd78ed5d5a56c49a8d4f67cb00b /fs | |
parent | 85ef35ab972b7484f41c3bb2bbc79de212e19129 (diff) |
ext4: avoid kernel warning when writing the superblock to a dead device
commit e86807862e6880809f191c4cea7f88a489f0ed34 upstream.
The xfstests generic/475 test switches the underlying device with
dm-error while running a stress test. This results in a large number
of file system errors, and since we can't lock the buffer head when
marking the superblock dirty in the ext4_grp_locked_error() case, it's
possible the superblock to be !buffer_uptodate() without
buffer_write_io_error() being true.
We need to set buffer_uptodate() before we call mark_buffer_dirty() or
this will trigger a WARN_ON. It's safe to do this since the
superblock must have been properly read into memory or the mount would
have been successful. So if buffer_uptodate() is not set, we can
safely assume that this happened due to a failed attempt to write the
superblock.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/super.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 8b9d2634be8f..282ebfd9d9f7 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4712,7 +4712,7 @@ static int ext4_commit_super(struct super_block *sb, int sync) BUFFER_TRACE(sbh, "marking dirty"); ext4_superblock_csum_set(sb); lock_buffer(sbh); - if (buffer_write_io_error(sbh)) { + if (buffer_write_io_error(sbh) || !buffer_uptodate(sbh)) { /* * Oh, dear. A previous attempt to write the * superblock failed. This could happen because the |