All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ext4: avoid kernel warning when writing the superblock to a dead device
@ 2018-12-31 19:48 Theodore Ts'o
  2018-12-31 19:48 ` [PATCH 2/3] ext4: use ext4_write_inode() when fsyncing w/o a journal Theodore Ts'o
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Theodore Ts'o @ 2018-12-31 19:48 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Theodore Ts'o, stable

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
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-01-23 11:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-31 19:48 [PATCH 1/3] ext4: avoid kernel warning when writing the superblock to a dead device Theodore Ts'o
2018-12-31 19:48 ` [PATCH 2/3] ext4: use ext4_write_inode() when fsyncing w/o a journal Theodore Ts'o
2019-01-23 11:34   ` Jan Kara
2018-12-31 19:48 ` [PATCH 3/3] ext4: track writeback errors using the generic tracking infrastructure Theodore Ts'o
2019-01-02 14:27 ` [PATCH 1/3] ext4: avoid kernel warning when writing the superblock to a dead device Sasha Levin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.