mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
block: reject NOWAIT buffered write fallback
blkdev_write_iter() rejects NOWAIT buffered writes, but does not
enforce this restriction when direct I/O falls back to buffered I/O.
Successful fallback waits for writeback, violating NOWAIT semantics.
Reject NOWAIT requests in blkdev_buffered_write() with -EAGAIN.
Fixes: c35fc7a5ab ("block_dev: support RFW_NOWAIT on block device nodes")
Signed-off-by: Julian Sun <sunjunchao@bytedance.com>
Link: https://patch.msgid.link/20261015091105.1315605-2-sunjunchao@bytedance.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
0f6b042f9a
commit
a08bf4b9f8
|
|
@ -714,6 +714,10 @@ blkdev_direct_write(struct kiocb *iocb, struct iov_iter *from)
|
|||
|
||||
static ssize_t blkdev_buffered_write(struct kiocb *iocb, struct iov_iter *from)
|
||||
{
|
||||
/* Buffered fallback waits for writeback, which NOWAIT cannot allow. */
|
||||
if (iocb->ki_flags & IOCB_NOWAIT)
|
||||
return -EAGAIN;
|
||||
|
||||
return iomap_file_buffered_write(iocb, from, &blkdev_iomap_ops, NULL,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user