Blob Blame History Raw
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 6 Jun 2019 15:34:35 +0200
Subject: [PATCH] nvme: skip nvme_update_disk_info() if the controller is not
 live
Patch-Mainline: never, solved differently upstream
References: bsc#1128432

If the controller is not live there is not point in trying to update
the disk information; and more importantly we'll never succeed in
freezing the queue as I/O is effectively stopped here.
So skip the function if the controller is not live.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 drivers/nvme/host/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 1cd8cfe42f60..65a7c79f0c9e 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1474,6 +1474,9 @@ static void nvme_update_disk_info(struct gendisk *disk,
 	sector_t capacity = le64_to_cpup(&id->nsze) << (ns->lba_shift - 9);
 	unsigned short bs = 1 << ns->lba_shift;
 
+	if (ns->ctrl->state != NVME_CTRL_LIVE)
+		return;
+
 	blk_mq_freeze_queue(disk->queue);
 	blk_integrity_unregister(disk);
 
-- 
2.16.4