Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/2] btrfs: fix generic/362 failures with nodatasum
Date: Wed, 27 May 2026 14:36:43 +0930	[thread overview]
Message-ID: <cover.1779846117.git.wqu@suse.com> (raw)

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


             reply	other threads:[~2026-05-27  5:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27  5:06 Qu Wenruo [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1779846117.git.wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox