Commit ce86dad2 authored by Daniel Wagner's avatar Daniel Wagner Committed by Christoph Hellwig

nvme-multipath: reset bdev to ns head when failover

When a request finally completes in end_io() after it has failed over,
the bdev pointer can be stale and thus the system can crash. Set the
bdev back to ns head, so the request is map to an active path when
resubmitted.
Signed-off-by: default avatarDaniel Wagner <dwagner@suse.de>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent d4060d2b
...@@ -70,6 +70,7 @@ void nvme_failover_req(struct request *req) ...@@ -70,6 +70,7 @@ void nvme_failover_req(struct request *req)
struct nvme_ns *ns = req->q->queuedata; struct nvme_ns *ns = req->q->queuedata;
u16 status = nvme_req(req)->status & 0x7ff; u16 status = nvme_req(req)->status & 0x7ff;
unsigned long flags; unsigned long flags;
struct bio *bio;
nvme_mpath_clear_current_path(ns); nvme_mpath_clear_current_path(ns);
...@@ -84,6 +85,8 @@ void nvme_failover_req(struct request *req) ...@@ -84,6 +85,8 @@ void nvme_failover_req(struct request *req)
} }
spin_lock_irqsave(&ns->head->requeue_lock, flags); spin_lock_irqsave(&ns->head->requeue_lock, flags);
for (bio = req->bio; bio; bio = bio->bi_next)
bio_set_dev(bio, ns->head->disk->part0);
blk_steal_bios(&ns->head->requeue_list, req); blk_steal_bios(&ns->head->requeue_list, req);
spin_unlock_irqrestore(&ns->head->requeue_lock, flags); spin_unlock_irqrestore(&ns->head->requeue_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment