]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
fs: aio: initialize .ki_write_stream of read-write request
authorMing Lei <ming.lei@redhat.com>
Wed, 7 May 2025 13:33:28 +0000 (21:33 +0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 7 May 2025 14:00:11 +0000 (08:00 -0600)
AIO needs to initialize .ki_write_stream explicitly for read/write request,
otherwise random .ki_write_stream is used, and cause -EINVAL returned for
aio write randomly.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Keith Busch <kbusch@kernel.org>
Cc: Kanchan Joshi <joshi.k@samsung.com>
Fixes: c27683da6406 ("block: expose write streams for block device nodes")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20250507133328.3040255-1-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/aio.c

index 7b976b564cfc4b34eb70a3a5cb60782fbee92288..793b7b15ec4bc23745e7ec4c74392cde8fe7fb9b 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1511,6 +1511,7 @@ static int aio_prep_rw(struct kiocb *req, const struct iocb *iocb, int rw_type)
 {
        int ret;
 
+       req->ki_write_stream = 0;
        req->ki_complete = aio_complete_rw;
        req->private = NULL;
        req->ki_pos = iocb->aio_offset;