From 037af793557ed192b2c10cf2379ac97abacedf55 Mon Sep 17 00:00:00 2001 From: Ming Lei Date: Wed, 7 May 2025 21:33:28 +0800 Subject: [PATCH] fs: aio: initialize .ki_write_stream of read-write request 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 Cc: Keith Busch Cc: Kanchan Joshi Fixes: c27683da6406 ("block: expose write streams for block device nodes") Signed-off-by: Ming Lei Reviewed-by: Keith Busch Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/20250507133328.3040255-1-ming.lei@redhat.com Signed-off-by: Jens Axboe --- fs/aio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/aio.c b/fs/aio.c index 7b976b564cfc..793b7b15ec4b 100644 --- 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; -- 2.25.1