diff options
author | Theodore Ts'o <tytso@mit.edu> | 2018-12-31 07:20:39 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-01-17 00:04:36 +0300 |
commit | 01db6e5cf81f905028de903f2290c10172226043 (patch) | |
tree | a6f16d7459fd9b0e39cc83a64726dc5bc820298b /fs/ext4/super.c | |
parent | 926cdac10439eda9ab7a11fd5f28eda203ccbb26 (diff) | |
download | linux-01db6e5cf81f905028de903f2290c10172226043.tar.xz |
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>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/ext4/super.c')
-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 ee0f30852835..a1cf7d68b4f0 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4904,7 +4904,7 @@ static int ext4_commit_super(struct super_block *sb, int sync) ext4_superblock_csum_set(sb); if (sync) 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 |