Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH 0/2] btrfs: fix generic/362 failures with nodatasum
@ 2026-05-27  5:06 Qu Wenruo
  2026-05-27  5:06 ` [PATCH 1/2] btrfs: fix false IO failure after falling back to buffered IO Qu Wenruo
  2026-05-27  5:06 ` [PATCH 2/2] btrfs: fix incorrect buffered IO fallback for append direct writes Qu Wenruo
  0 siblings, 2 replies; 8+ messages in thread
From: Qu Wenruo @ 2026-05-27  5:06 UTC (permalink / raw)
  To: linux-btrfs

The test case generic/362 is pretty well hidden by several factors:

- "nodatasum" will not take effect due to the bad design of the test
  case
  If the target file already exists, the test case will reuse it,
  meanwhile "nodatasum" mount option only affects new files, meaning
  if the test case is executed before with data checksum, it will never
  go through the nodatasum path.

  There is already an update on the test case to make the failure
  reliably reproducible:
  https://lore.kernel.org/linux-btrfs/20260526070055.60193-1-wqu@suse.com/

- Btrfs always falls back to buffered IO if the inode has csum
  Thus we do not exercise the zero-copy path, hide the failure for the
  default mount option.

With that said, the test case failure needs to be fixed, and there are
two bugs in the direct io path:

- Treat any short write as an error
  This is especially common as we have disabled page faulting for
  reading from the @from iov_iter.

  This is fixed by the first patch.

- No isize rollback after a short write
  The isize is increased at btrfs_get_blocks_direct_write() but when a
  short write happened, the isize is not propoerly rolledback, causing
  later buffered fallback to write at the new isize.

Qu Wenruo (2):
  btrfs: fix false IO failure after falling back to buffered IO
  btrfs: fix incorrect buffered IO fallback for append direct writes

 fs/btrfs/direct-io.c    | 33 +++++++++++++++++++++++++++------
 fs/btrfs/inode.c        |  6 +-----
 fs/btrfs/ordered-data.c | 12 ++++++++++++
 fs/btrfs/ordered-data.h |  2 ++
 4 files changed, 42 insertions(+), 11 deletions(-)

-- 
2.54.0


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

end of thread, other threads:[~2026-05-29  7:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-27  5:06 [PATCH 0/2] btrfs: fix generic/362 failures with nodatasum Qu Wenruo
2026-05-27  5:06 ` [PATCH 1/2] btrfs: fix false IO failure after falling back to buffered IO Qu Wenruo
2026-05-27 16:01   ` Boris Burkov
2026-05-27 21:40     ` Qu Wenruo
2026-05-29  4:32       ` Qu Wenruo
2026-05-29  4:37         ` Qu Wenruo
2026-05-27  5:06 ` [PATCH 2/2] btrfs: fix incorrect buffered IO fallback for append direct writes Qu Wenruo
2026-05-29  7:55   ` Qu Wenruo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox