Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

block: move bio queue-transition flag fixups into blk_steal_bios()

blk_steal_bios() transfers bios from a request to a bio_list when the
request is requeued to a different queue. The NVMe multipath failover
path (nvme_failover_req) currently open-codes clearing of REQ_POLLED,
bi_cookie, and REQ_NOWAIT on each bio before calling blk_steal_bios().

Move these fixups into blk_steal_bios() itself so that any caller
automatically gets correct flag state when bios cross queue boundaries.
Simplify nvme_failover_req() accordingly.

Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20260226031243.87200-2-kch@nvidia.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Chaitanya Kulkarni and committed by
Jens Axboe
b2c45ced 89d10b78

+18 -14
+17
block/blk-mq.c
··· 3424 3424 */ 3425 3425 void blk_steal_bios(struct bio_list *list, struct request *rq) 3426 3426 { 3427 + struct bio *bio; 3428 + 3429 + for (bio = rq->bio; bio; bio = bio->bi_next) { 3430 + if (bio->bi_opf & REQ_POLLED) { 3431 + bio->bi_opf &= ~REQ_POLLED; 3432 + bio->bi_cookie = BLK_QC_T_NONE; 3433 + } 3434 + /* 3435 + * The alternate request queue that we may end up submitting 3436 + * the bio to may be frozen temporarily, in this case REQ_NOWAIT 3437 + * will fail the I/O immediately with EAGAIN to the issuer. 3438 + * We are not in the issuer context which cannot block. Clear 3439 + * the flag to avoid spurious EAGAIN I/O failures. 3440 + */ 3441 + bio->bi_opf &= ~REQ_NOWAIT; 3442 + } 3443 + 3427 3444 if (rq->bio) { 3428 3445 if (list->tail) 3429 3446 list->tail->bi_next = rq->bio;
+1 -14
drivers/nvme/host/multipath.c
··· 154 154 } 155 155 156 156 spin_lock_irqsave(&ns->head->requeue_lock, flags); 157 - for (bio = req->bio; bio; bio = bio->bi_next) { 157 + for (bio = req->bio; bio; bio = bio->bi_next) 158 158 bio_set_dev(bio, ns->head->disk->part0); 159 - if (bio->bi_opf & REQ_POLLED) { 160 - bio->bi_opf &= ~REQ_POLLED; 161 - bio->bi_cookie = BLK_QC_T_NONE; 162 - } 163 - /* 164 - * The alternate request queue that we may end up submitting 165 - * the bio to may be frozen temporarily, in this case REQ_NOWAIT 166 - * will fail the I/O immediately with EAGAIN to the issuer. 167 - * We are not in the issuer context which cannot block. Clear 168 - * the flag to avoid spurious EAGAIN I/O failures. 169 - */ 170 - bio->bi_opf &= ~REQ_NOWAIT; 171 - } 172 159 blk_steal_bios(&ns->head->requeue_list, req); 173 160 spin_unlock_irqrestore(&ns->head->requeue_lock, flags); 174 161