The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 0/2] block device write path fixes
@ 2026-08-02 11:14 Tal Zussman
  2026-08-02 11:14 ` [PATCH 1/2] block: use iomap_dirty_folio for block devices Tal Zussman
  2026-08-02 11:14 ` [PATCH 2/2] block: take i_rwsem for the direct I/O write fallback Tal Zussman
  0 siblings, 2 replies; 7+ messages in thread
From: Tal Zussman @ 2026-08-02 11:14 UTC (permalink / raw)
  To: Jens Axboe, Johannes Thumshirn, Luis Chamberlain, Darrick J. Wong,
	Christoph Hellwig
  Cc: linux-block, linux-kernel, Tal Zussman, Sashiko

Two independent fixes for the block device write path. Both issues were
found by Sashiko during review of the "block: enable RWF_DONTCACHE for
block devices" series [1] and are independent of it.

Patch 1 fixes silently lost mmap writes with CONFIG_BUFFER_HEAD=n:
def_blk_aops uses filemap_dirty_folio, which does not set the
per-block dirty bits in the folio's iomap_folio_state, so writeback
finds no dirty blocks and submits no I/O.

Patch 2 makes blkdev_write_iter() take i_rwsem shared around the
buffered-write fallback for a partial direct I/O write. The fallback
currently runs with no lock held and races set_blocksize() changing
i_blkbits and the mapping's minimum folio order, which can trip
VM_BUG_ON_FOLIO in __filemap_add_folio() on kernels with block sizes
above PAGE_SIZE.

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

[1] https://lore.kernel.org/all/20260730-blk-dontcache-v7-0-3e8e6850068d@columbia.edu/

Signed-off-by: Tal Zussman <tz2294@columbia.edu>
---
Tal Zussman (2):
      block: use iomap_dirty_folio for block devices
      block: take i_rwsem for the direct I/O write fallback

 block/fops.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
---
base-commit: f5098b6bae761e346ebcd9da7f95622c04733cff
change-id: 20260801-blkdev-fixes-771b1c314ebb

Best regards,
-- 
Tal Zussman <tz2294@columbia.edu>


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

end of thread, other threads:[~2026-08-05 22:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-02 11:14 [PATCH 0/2] block device write path fixes Tal Zussman
2026-08-02 11:14 ` [PATCH 1/2] block: use iomap_dirty_folio for block devices Tal Zussman
2026-08-04 14:01   ` Christoph Hellwig
2026-08-05 22:44     ` Tal Zussman
2026-08-02 11:14 ` [PATCH 2/2] block: take i_rwsem for the direct I/O write fallback Tal Zussman
2026-08-02 17:11   ` Tal Zussman
2026-08-04 14:04     ` Christoph Hellwig

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