ublk: setup ublk_io correctly in case of ublk_get_data() failure
authorMing Lei <ming.lei@redhat.com>
Tue, 24 Jun 2025 10:41:21 +0000 (18:41 +0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 25 Jun 2025 02:45:31 +0000 (20:45 -0600)
commit4c8a951787ffc4b61a547db9866196104971b5fd
treeedfd040d6c9cf64b210c2753b475c42ab52ea542
parent81b4d1a1d03301dcca8af5c58eded9e535f1f6ed
ublk: setup ublk_io correctly in case of ublk_get_data() failure

If ublk_get_data() fails, -EIOCBQUEUED is returned and the current command
becomes ASYNC. And the only reason is that mapping data can't move on,
because of no enough pages or pending signal, then the current ublk request
has to be requeued.

Once the request need to be requeued, we have to setup `ublk_io` correctly,
including io->cmd and flags, otherwise the request may not be forwarded to
ublk server successfully.

Fixes: 9810362a57cb ("ublk: don't call ublk_dispatch_req() for NEED_GET_DATA")
Reported-by: Changhui Zhong <czhong@redhat.com>
Closes: https://lore.kernel.org/linux-block/CAGVVp+VN9QcpHUz_0nasFf5q9i1gi8H8j-G-6mkBoqa3TyjRHA@mail.gmail.com/
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Tested-by: Changhui Zhong <czhong@redhat.com>
Link: https://lore.kernel.org/r/20250624104121.859519-1-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/ublk_drv.c