When rescanning namespaces after an AEN we will issue Identify Namespace
comands to namespaces that have gone away, so don't warn for this specific
case.

Signed-off-by: Christoph Hellwig <h...@lst.de>
---
 drivers/nvme/host/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 1ae77428a1a5..7ad3cfc9d4e1 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -984,7 +984,9 @@ static struct nvme_id_ns *nvme_identify_ns(struct nvme_ctrl 
*ctrl,
 
        error = nvme_submit_sync_cmd(ctrl->admin_q, &c, id, sizeof(*id));
        if (error) {
-               dev_warn(ctrl->device, "Identify namespace failed\n");
+               /* don't warn on a namespace that has gone away */
+               if (error < 0 || ((error & ~NVME_SC_DNR) != NVME_SC_INVALID_NS))
+                       dev_warn(ctrl->device, "Identify namespace failed\n");
                kfree(id);
                return NULL;
        }
-- 
2.17.0

Reply via email to