diff --git a/patches.suse/nvme-multipath-reset-bdev-to-ns-head-when-failover.patch b/patches.suse/nvme-multipath-reset-bdev-to-ns-head-when-failover.patch index a3aa6dd..eeafa0f 100644 --- a/patches.suse/nvme-multipath-reset-bdev-to-ns-head-when-failover.patch +++ b/patches.suse/nvme-multipath-reset-bdev-to-ns-head-when-failover.patch @@ -3,7 +3,7 @@ Date: Mon, 3 May 2021 19:03:03 +0200 Subject: nvme-multipath: reset bdev to ns head when failover Patch-mainline: v5.13-rc1 Git-commit: ce86dad222e9074d3ec174ec81cb463a770331b5 -References: bsc#178378 bsc#1182999 +References: bsc#1178378 bsc#1182999 bsc#1186681 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 @@ -13,37 +13,28 @@ resubmitted. Signed-off-by: Daniel Wagner Reviewed-by: Hannes Reinecke Signed-off-by: Christoph Hellwig -[dwagner: use bdget_disk() to retrieve bdev] +[dwagner: assign bi_disk directly] Signed-off-by: Daniel Wagner --- - drivers/nvme/host/multipath.c | 7 +++++++ - 1 file changed, 7 insertions(+) + drivers/nvme/host/multipath.c | 3 +++ + 1 file changed, 3 insertions(+) --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c -@@ -69,7 +69,9 @@ bool nvme_failover_req(struct request *r - { +@@ -70,6 +70,7 @@ bool nvme_failover_req(struct request *r struct nvme_ns *ns = req->q->queuedata; u16 status = nvme_req(req)->status; -+ struct block_device *bdev; unsigned long flags; + struct bio *bio; switch (status & 0x7ff) { case NVME_SC_ANA_TRANSITION: -@@ -103,10 +105,15 @@ bool nvme_failover_req(struct request *r - return false; +@@ -104,6 +105,8 @@ bool nvme_failover_req(struct request *r } -+ bdev = bdget_disk(ns->head->disk, 0); -+ WARN_ON(!bdev); spin_lock_irqsave(&ns->head->requeue_lock, flags); + for (bio = req->bio; bio; bio = bio->bi_next) -+ bio_set_dev(bio, bdev); ++ bio->bi_disk = ns->head->disk; blk_steal_bios(&ns->head->requeue_list, req); spin_unlock_irqrestore(&ns->head->requeue_lock, flags); blk_mq_end_request(req, 0); -+ bdput(bdev); - - kblockd_schedule_work(&ns->head->requeue_work); - return true; diff --git a/patches.suse/nvme-multipath-retry-commands-for-dying-queues.patch b/patches.suse/nvme-multipath-retry-commands-for-dying-queues.patch index 6b98fb4..44b0393 100644 --- a/patches.suse/nvme-multipath-retry-commands-for-dying-queues.patch +++ b/patches.suse/nvme-multipath-retry-commands-for-dying-queues.patch @@ -20,7 +20,7 @@ Signed-off-by: Hannes Reinecke --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c -@@ -101,8 +101,12 @@ bool nvme_failover_req(struct request *r +@@ -100,8 +100,12 @@ bool nvme_failover_req(struct request *r nvme_mpath_clear_current_path(ns); break; default: @@ -34,4 +34,4 @@ Signed-off-by: Hannes Reinecke + return false; } - bdev = bdget_disk(ns->head->disk, 0); + spin_lock_irqsave(&ns->head->requeue_lock, flags);