diff options
| author | Tal Zussman <tz2294@columbia.edu> | 2026-10-09 12:50:12 -0400 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-10-12 10:29:35 -0600 |
| commit | d16519a561f4ccc2cebbf52831435833cac1fec6 (patch) | |
| tree | 3315edc1e43e9d860bb884b6980a5cbb607257c1 /rust/kernel/alloc/kvec | |
| parent | 5574b81c642e83d962732e86399020517f5f15af (diff) | |
block: honor IOCB_NOWAIT in the block device buffered read path
blkdev_read_iter() takes inode_lock_shared() unconditionally around
filemap_read(). Unlike blkdev_write_iter(), it does not reject
IOCB_NOWAIT for buffered I/O, so a non-blocking read, or the buffered
tail of a short IOCB_NOWAIT direct read, blocks behind set_blocksize()
holding i_rwsem across sync_blockdev().
A preadv2(RWF_NOWAIT) issued while another thread changes the block
size with a dirty page cache blocks for as long as sync_blockdev()
takes, 4 to 6 seconds on a scsi_debug device with delay=5.
Use inode_trylock_shared() for IOCB_NOWAIT and return the bytes the
direct path already read, or -EAGAIN if none, when the lock is
contended, preserving NOWAIT semantics.
Fixes: c0e473a0d226 ("block: fix race between set_blocksize and read paths")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20260802-blkdev-fixes-v1-0-a82fc549fd74%40columbia.edu?part=2
Assisted-by: Claude:claude-fable-5
Reviewed-by: Hannes Reinecke <hare@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Tal Zussman <tz2294@columbia.edu>
Link: https://patch.msgid.link/20261009-blkdev-fixes-v6-4-307939c387df@columbia.edu
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'rust/kernel/alloc/kvec')
0 files changed, 0 insertions, 0 deletions
