]> www.infradead.org Git - nvme.git/commit
loop: stop using vfs_iter_{read,write} for buffered I/O
authorChristoph Hellwig <hch@lst.de>
Wed, 9 Apr 2025 13:09:40 +0000 (15:09 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 16 Apr 2025 00:59:15 +0000 (18:59 -0600)
commitf2fed441c69b9237760840a45a004730ff324faf
tree5afbfb8b3ebe7f720fcd6d5fdb6b5b2638bd8a9d
parent0dba7a05b9e47d8b546399117b0ddf2426dc6042
loop: stop using vfs_iter_{read,write} for buffered I/O

vfs_iter_{read,write} always perform direct I/O when the file has the
O_DIRECT flag set, which breaks disabling direct I/O using the
LOOP_SET_STATUS / LOOP_SET_STATUS64 ioctls.

This was recenly reported as a regression, but as far as I can tell
was only uncovered by better checking for block sizes and has been
around since the direct I/O support was added.

Fix this by using the existing aio code that calls the raw read/write
iter methods instead.  Note that despite the comments there is no need
for block drivers to ever call flush_dcache_page themselves, and the
call is a left-over from prehistoric times.

Fixes: ab1cb278bc70 ("block: loop: introduce ioctl command of LOOP_SET_DIRECT_IO")
Reported-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Tested-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/20250409130940.3685677-1-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/loop.c