Skip to content

Commit e868078

Browse files
committed
ext4: avoid kernel warning when writing the superblock to a dead device
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
1 parent 2b08b1f commit e868078

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/ext4/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4902,7 +4902,7 @@ static int ext4_commit_super(struct super_block *sb, int sync)
49024902
ext4_superblock_csum_set(sb);
49034903
if (sync)
49044904
lock_buffer(sbh);
4905-
if (buffer_write_io_error(sbh)) {
4905+
if (buffer_write_io_error(sbh) || !buffer_uptodate(sbh)) {
49064906
/*
49074907
* Oh, dear. A previous attempt to write the
49084908
* superblock failed. This could happen because the

0 commit comments

Comments
 (0)