Skip to content

Commit 99160af

Browse files
sagigrimbergkeithbusch
authored andcommitted
nvme-mpath: fix I/O failure with EAGAIN when failing over I/O
It is possible that the next available path we failover to, happens to be frozen (for example if it is during connection establishment). If the original I/O was set with NOWAIT, this cause the I/O to unnecessarily fail because the request queue cannot be entered, hence the I/O fails with EAGAIN. The NOWAIT restriction that was originally set for the I/O is no longer relevant or needed because this is the nvme requeue context. Hence we clear the REQ_NOWAIT flag when failing over I/O. This fix a simple test case of nvme controller reset during I/O when the multipath device that has only a single path and I/O fails with "Resource temporarily unavailable" errno. Note that this reproduces with io_uring which by default sets IOCB_NOWAIT by default. Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent 86da1ba commit 99160af

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

drivers/nvme/host/multipath.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ void nvme_failover_req(struct request *req)
106106
bio->bi_opf &= ~REQ_POLLED;
107107
bio->bi_cookie = BLK_QC_T_NONE;
108108
}
109+
/*
110+
* The alternate request queue that we may end up submitting
111+
* the bio to may be frozen temporarily, in this case REQ_NOWAIT
112+
* will fail the I/O immediately with EAGAIN to the issuer.
113+
* We are not in the issuer context which cannot block. Clear
114+
* the flag to avoid spurious EAGAIN I/O failures.
115+
*/
116+
bio->bi_opf &= ~REQ_NOWAIT;
109117
}
110118
blk_steal_bios(&ns->head->requeue_list, req);
111119
spin_unlock_irqrestore(&ns->head->requeue_lock, flags);

0 commit comments

Comments
 (0)