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: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>

authored by Daniel Wagner and committed by Christoph Hellwig ce86dad2 d4060d2b

+3
+3
drivers/nvme/host/multipath.c
··· 70 struct nvme_ns *ns = req->q->queuedata; 71 u16 status = nvme_req(req)->status & 0x7ff; 72 unsigned long flags; 73 74 nvme_mpath_clear_current_path(ns); 75 ··· 85 } 86 87 spin_lock_irqsave(&ns->head->requeue_lock, flags); 88 blk_steal_bios(&ns->head->requeue_list, req); 89 spin_unlock_irqrestore(&ns->head->requeue_lock, flags); 90
··· 70 struct nvme_ns *ns = req->q->queuedata; 71 u16 status = nvme_req(req)->status & 0x7ff; 72 unsigned long flags; 73 + struct bio *bio; 74 75 nvme_mpath_clear_current_path(ns); 76 ··· 84 } 85 86 spin_lock_irqsave(&ns->head->requeue_lock, flags); 87 + for (bio = req->bio; bio; bio = bio->bi_next) 88 + bio_set_dev(bio, ns->head->disk->part0); 89 blk_steal_bios(&ns->head->requeue_list, req); 90 spin_unlock_irqrestore(&ns->head->requeue_lock, flags); 91