[PATCH] nvme: add bug report info for global duplicate id
Keith Busch
kbusch at fb.com
Mon Jun 6 09:40:47 PDT 2022
From: Keith Busch <kbusch at kernel.org>
The recent global id check is finding poorly implemented devices in the
wild. Include relavant device information in the output to help quicken
an appropriate quirk patch.
Signed-off-by: Keith Busch <kbusch at kernel.org>
---
drivers/nvme/host/core.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 24165daee3c8..4cda5024a352 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3852,6 +3852,13 @@ static int nvme_global_check_duplicate_ids(struct nvme_subsystem *this,
return ret;
}
+static int nvme_str_len(char *s, int len)
+{
+ while (s[len - 1] == ' ')
+ len--;
+ return len;
+}
+
static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid,
struct nvme_ns_ids *ids, bool is_shared)
{
@@ -3861,8 +3868,18 @@ static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid,
ret = nvme_global_check_duplicate_ids(ctrl->subsys, ids);
if (ret) {
+ struct nvme_subsystem *subsys = ctrl->subsys;
+
dev_err(ctrl->device,
"globally duplicate IDs for nsid %d\n", nsid);
+ dev_err(ctrl->device,
+ "bug report info: VID:%04x model:%.*s firmware:%.*s\n",
+ subsys->vendor_id,
+ nvme_str_len(subsys->model, sizeof(subsys->model)),
+ subsys->model,
+ nvme_str_len(subsys->firmware_rev,
+ sizeof(subsys->firmware_rev)),
+ subsys->firmware_rev);
return ret;
}
--
2.30.2
More information about the Linux-nvme
mailing list