Skip to content

block device fixes for large block sizes, IOCB_NOWAIT, and direct I/O

Tal Zussman linux-block linux-fsdevel linux-xfs lkml 6 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected] change-id 20260801-blkdev-fixes-771b1c314ebb

Versions newest first

  1. v6 Latest9 patches 4 repliesApplied
  2. v59 patches 7 repliesSuperseded
  3. v48 patches 8 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v37 patches10 repliesSuperseded
v27 patches21 repliesSuperseded
v12 patches4 repliesSuperseded

Changes in v6 from the cover letter

- Rebase onto for-7.4/block.
- Add tags from v5 (thanks Hannes, John!)
- Patch 2: Adapt the IOCB_NOWAIT short-write return to the new
FUA-aware need_sync handling, due to the rebase.
- Link to v5: https://patch.msgid.link/[email protected]

Patches in v6 Applied

#Subject and filesSizeRepliesApplied
1/9block: use iomap_dirty_folio for block devicesblock/fops.c+1 -10 replies
2/9block: take i_rwsem for the direct I/O write fallbackblock/fops.c+22 -30 replies
3/9block: take i_rwsem for the splice read pathblock/fops.c+17 -10 replies
4/9block: honor IOCB_NOWAIT in the block device buffered read pathblock/fops.c+9 -10 replies
5/9block: fail a short atomic pin in bio_iov_iter_get_pages()block/bio.c block/fops.c+36 -222 replies
6/9block: don't fall back to buffered I/O for atomic writesblock/fops.c+3 -20 replies
7/9iomap: reject atomic writes in iomap_file_buffered_write()fs/iomap/buffered-io.c+4 -00 replies
8/9block: unpin all pages of a bvec in bio_iov_iter_align_down()block/bio.c+27 -120 replies
9/9block: remove dead metadata handling from the async direct I/O pathblock/fops.c+0 -100 replies

Reviews trailers per patch

All 9 patches have a Reviewed-by or Acked-by.

PatchChristoph HellwigHannes ReineckeShin'ichiro KawasakiJohn Garry
1/9R-b R-b
2/9R-b R-b T-b
3/9R-b R-b T-b
4/9R-b R-b
5/9R-b R-b
6/9R-b R-b
7/9R-b R-b
8/9R-b R-b T-b
9/9R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v6 thread

Cover letter [PATCH v6 0/9] block device fixes for large block sizes, IOCB_NOWAIT, and direct I/O

A set of independent fixes for the block device file operations. The first two were found by Sashiko while reviewing the RWF_DONTCACHE series [1]. The fourth and fifth were found by Sashiko's review of v1 of this series, and the rest came from asking an LLM to find any similar or related issues. Each issue has been reproduced, with the fixes resolving the issues.

Patch 1 fixes silently lost mmap writes with CONFIG_BUFFER_HEAD=n.

Patches 2 and 3 take i_rwsem around the direct I/O write fallback and the splice read path, which race set_blocksize() changing the mapping's minimum folio order.

Patch 4 makes the buffered read path honor IOCB_NOWAIT instead of blocking on i_rwsem.

Patch 5 makes IOCB_ATOMIC writes fail instead of tearing, and patch 6 stops the buffered fallback from retrying an atomic write. Block devices can reject both paths into the fallback before submitting any I/O, so we fail rather than issue a WARN() like ext4 does. Patch 7 makes iomap_file_buffered_write() reject IOCB_ATOMIC, so no other buffered fallback can complete an atomic write either.

Patch 8 fixes leaked page pins in bio_iov_iter_align_down(), and patch 9 removes dead metadata handling in the async direct I/O path.

These issues are currently unlikely to be hit in practice due to the specific configurations required to trigger them.

The reproducer for patch 1 is in blktests as block/048, and tests for patches 2, 3 and 8 are posted at [2].

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/linux-block/[email protected]/

---
Changes in v6:
- Rebase onto for-7.4/block.
- Add tags from v5 (thanks Hannes, John!)
- Patch 2: Adapt the IOCB_NOWAIT short-write return to the new
FUA-aware need_sync handling, due to the rebase.
- Link to v5: https://patch.msgid.link/[email protected]

Changes in v5:
- Add tags from v4 (thanks Hannes, John, Christoph!).
- Patch 5: Use a common error label, per John.
- New patch 7: Reject IOCB_ATOMIC in iomap_file_buffered_write(), per
John.
- Link to v4: https://patch.msgid.link/[email protected]

Changes in v4:
- Rebase onto block-7.3.
- Add tags from v3 (thanks Hannes, Shin'ichiro!).
- Split patch 5 into two patches, per John.
- Patch 5: Rename len variable to size, per John.
- Patch 5: Move the IOCB_NOWAIT check up too, per John.
- Patch 7: Expand the comment on counting the trimmed pages.
- Link to v3: https://patch.msgid.link/[email protected]

Changes in v3:
- Add tags from v2 (thanks Hannes, Christoph!).
- 5/7: Check for a short atomic pin in bio_iov_iter_get_pages() and
return -EINVAL, per John. Dropped the tags.
- 6/7: Use bvec_unpin() for dropped bvecs.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Rebase on current master.
- 1/7: Add Christoph's Reviewed-by and submit the reproducer to
blktests.
- 2/7: Skip the buffered fallback for IOCB_NOWAIT direct writes, per
Sashiko.
- 2/7: Change the Fixes: commit from c0e473a0d226 to 3c20917120ce
- 3/7 to 7/7: New patches.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Tal Zussman (9):
block: use iomap_dirty_folio for block devices
block: take i_rwsem for the direct I/O write fallback
block: take i_rwsem for the splice read path
block: honor IOCB_NOWAIT in the block device buffered read path
block: fail a short atomic pin in bio_iov_iter_get_pages()
block: don't fall back to buffered I/O for atomic writes
iomap: reject atomic writes in iomap_file_buffered_write()
block: unpin all pages of a bvec in bio_iov_iter_align_down()
block: remove dead metadata handling from the async direct I/O path

 block/bio.c            | 85 +++++++++++++++++++++++++++++++++-----------------
 block/fops.c           | 78 ++++++++++++++++++++++++++++++++-------------
 fs/iomap/buffered-io.c |  4 +++
 3 files changed, 117 insertions(+), 50 deletions(-)

---
base-commit: 69ae59173a5668d015ab2733c8628ed542f00ccc
change-id: 20260801-blkdev-fixes-771b1c314ebb

Best regards,

Signature · 1 line
Tal Zussman <[email protected]>