Linux block layer
 help / color / mirror / Atom feed
From: Tal Zussman <tz2294@columbia.edu>
To: Jens Axboe <axboe@kernel.dk>,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>,
	Luis Chamberlain <mcgrof@kernel.org>,
	"Darrick J. Wong" <djwong@kernel.org>,
	Christoph Hellwig <hch@lst.de>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tal Zussman <tz2294@columbia.edu>,
	Sashiko <sashiko-bot@kernel.org>
Subject: [PATCH 0/2] block device write path fixes
Date: Sun, 02 Aug 2026 07:14:25 -0400	[thread overview]
Message-ID: <20260802-blkdev-fixes-v1-0-a82fc549fd74@columbia.edu> (raw)

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>


             reply	other threads:[~2026-08-02 11:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-02 11:14 Tal Zussman [this message]
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

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=20260802-blkdev-fixes-v1-0-a82fc549fd74@columbia.edu \
    --to=tz2294@columbia.edu \
    --cc=axboe@kernel.dk \
    --cc=djwong@kernel.org \
    --cc=hch@lst.de \
    --cc=johannes.thumshirn@wdc.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=sashiko-bot@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