[PATCH 1/3] [SRU][N] nvme: requeue namespace scan on missed AENs

Heitor Alves de Siqueira halves at canonical.com
Fri Jul 4 18:12:26 UTC 2025


From: Hannes Reinecke <hare at kernel.org>

BugLink: https://bugs.launchpad.net/bugs/2115209

Scanning for namespaces can take some time, so if the target is
reconfigured while the scan is running we may miss a Attached Namespace
Attribute Changed AEN.

Check if the NVME_AER_NOTICE_NS_CHANGED bit is set once the scan has
finished, and requeue scanning to pick up any missed change.

Signed-off-by: Hannes Reinecke <hare at kernel.org>
Reviewed-by: Keith Busch <kbusch at kernel.org>
Signed-off-by: Christoph Hellwig <hch at lst.de>
(cherry picked from commit 9546ad1a9bda7362492114f5866b95b0ac4a100e)
Signed-off-by: Heitor Alves de Siqueira <halves at canonical.com>
---
 drivers/nvme/host/core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 68657ac91e88..d2143bfb8fee 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -4076,6 +4076,10 @@ static void nvme_scan_work(struct work_struct *work)
 			nvme_scan_ns_sequential(ctrl);
 	}
 	mutex_unlock(&ctrl->scan_lock);
+
+	/* Requeue if we have missed AENs */
+	if (test_bit(NVME_AER_NOTICE_NS_CHANGED, &ctrl->events))
+		nvme_queue_scan(ctrl);
 }
 
 /*
-- 
2.50.0




More information about the kernel-team mailing list