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 --- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index d6c142d73d99..fb12d3c17c1b 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4902,7 +4902,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
Hi,
[This is an automated email]
This commit has been processed because it contains a -stable tag. The stable tag indicates that it's relevant for the following trees: all
The bot has tested the following trees: v4.20.0, v4.19.13, v4.14.91, v4.9.148, v4.4.169, v3.18.131,
v4.20.0: Build OK! v4.19.13: Build OK! v4.14.91: Build OK! v4.9.148: Build OK! v4.4.169: Failed to apply! Possible dependencies: 1566a48aaa10 ("ext4: don't lock buffer in ext4_commit_super if holding spinlock") 4743f8399061 ("ext4: Fix WARN_ON_ONCE in ext4_commit_super()")
v3.18.131: Failed to apply! Possible dependencies: 1566a48aaa10 ("ext4: don't lock buffer in ext4_commit_super if holding spinlock") 4743f8399061 ("ext4: Fix WARN_ON_ONCE in ext4_commit_super()") 564bc402526e ("ext4, jbd2: add REQ_FUA flag when recording an error in the superblock")
How should we proceed with this patch?
-- Thanks, Sasha
linux-stable-mirror@lists.linaro.org