All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] btrfs: zoned: fix EXTENT_BUFFER_ZONED_ZEROOUT handling
@ 2024-03-26  5:39 Naohiro Aota
  2024-03-26  5:39 ` [PATCH v2 1/2] btrfs: zoned: do not flag ZEROOUT on non-dirty extent bufffer Naohiro Aota
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Naohiro Aota @ 2024-03-26  5:39 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Naohiro Aota

Btrfs clears the content of an extent buffer marked as
EXTENT_BUFFER_ZONED_ZEROOUT before the bio submission. This mechanism is
introduced to prevent a write hole of an extent buffer, which is once
allocated, marked dirty, but turns out unnecessary and cleaned up within
one transaction operation.

Currently, btrfs_clear_buffer_dirty() marks the extent buffer as
EXTENT_BUFFER_ZONED_ZEROOUT, and skip the enteri function. If this call
happens while the buffer is under IO (with the WRITEBACK flag set, without
the DIRTY flag), we can add the ZEROOUT flag and clear the buffer's content
just before a bio submission. As a result, 1) it can lead to adding faulty
delayed reference item which leads to a FS corrupted (EUCLEAN) error, and
2) it writes out cleared tree node on disk

Fix them by skipping a non-dirty extent buffer. Also, the second patch adds
ASSERT and WARN to catch invalid EXTENT_BUFFER_ZONED_ZEROOUT state.

Naohiro Aota (2):
  btrfs: zoned: do not flag ZEROOUT on non-dirty extent bufffer
  btrfs: zoned: add ASSERT and WARN for EXTENT_BUFFER_ZONED_ZEROOUT
    handling

 fs/btrfs/extent-tree.c | 8 ++++++++
 fs/btrfs/extent_io.c   | 3 ++-
 2 files changed, 10 insertions(+), 1 deletion(-)

-- 
Changes:
- Change the fix to address the root cause.

v1: https://lore.kernel.org/linux-btrfs/3f4f2a0ff1a6c818050434288925bdcf3cd719e5.1709124777.git.naohiro.aota@wdc.com/
--
2.44.0


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

end of thread, other threads:[~2024-03-28 19:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-26  5:39 [PATCH v2 0/2] btrfs: zoned: fix EXTENT_BUFFER_ZONED_ZEROOUT handling Naohiro Aota
2024-03-26  5:39 ` [PATCH v2 1/2] btrfs: zoned: do not flag ZEROOUT on non-dirty extent bufffer Naohiro Aota
2024-03-26  5:39 ` [PATCH v2 2/2] btrfs: zoned: add ASSERT and WARN for EXTENT_BUFFER_ZONED_ZEROOUT handling Naohiro Aota
2024-03-28 19:50   ` David Sterba
2024-03-26 16:50 ` [PATCH v2 0/2] btrfs: zoned: fix " Johannes Thumshirn
2024-03-28 19:49   ` David Sterba

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.