mirror of
https://github.com/torvalds/linux.git
synced 2026-09-11 20:13:02 +02:00
nvme: print namespace IDs as unsigned 32bit value
NSIDs are 32-bit unsigned values, but a number of log messages print them with %d. An NSID larger than 0x7fffffff is rendered as a negative number, which is confusing in the kernel log and makes the message hard to correlate with the namespace it talks about. Sparse NSID spaces where high NSIDs are common are the most likely to hit this. The nsid sysfs attribute has the same problem, and there it is worse because userspace parses the value. For example: $ grep . /sys/class/block/nvme0*/nsid /sys/class/block/nvme0c0n1/nsid:10 /sys/class/block/nvme0c0n2/nsid:-16 /sys/class/block/nvme0c0n3/nsid:11 /sys/class/block/nvme0c0n4/nsid:-2000000016 /sys/class/block/nvme0n1/nsid:10 /sys/class/block/nvme0n2/nsid:-16 /sys/class/block/nvme0n3/nsid:11 /sys/class/block/nvme0n4/nsid:-2000000016 $ Print all of them with %u. Several messages in these files, including two in zns.c right next to the ones being changed, already use %u, so this only makes the rest consistent with them. No functional change other than how the NSID is formatted. Fixes:2b9b6e86bc("NVMe: Export namespace attributes to sysfs") Fixes:1d5df6af8c("nvme: don't blindly overwrite identifiers on disk revalidate") Fixes:ed754e5dee("nvme: track shared namespaces") Fixes:9ad1927a3b("nvme: always search for namespace head") Fixes:71010c3094("nvme: implement multiple I/O Command Set support") Fixes:2f4c9ba23b("nvme: export zoned namespaces without Zone Append support read-only") Fixes:0ec84df495("nvme-core: check ctrl css before setting up zns") Fixes:2079f41ec6("nvme: check that EUI/GUID/UUID are globally unique") Fixes:ce8d78616a("nvme: warn about shared namespaces without CONFIG_NVME_MULTIPATH") Fixes:ac522fc6c3("nvme: don't reject probe due to duplicate IDs for single-ported PCIe devices") Signed-off-by: Mohamed Khalfella <mkhalfella@purestorage.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <kbusch@kernel.org>
This commit is contained in:
parent
4ed7f3d7d4
commit
b2d8f2a372
|
|
@ -1610,7 +1610,7 @@ static int nvme_identify_ns_descs(struct nvme_ctrl *ctrl,
|
|||
}
|
||||
|
||||
if (nvme_multi_css(ctrl) && !csi_seen) {
|
||||
dev_warn(ctrl->device, "Command set not reported for nsid:%d\n",
|
||||
dev_warn(ctrl->device, "Command set not reported for nsid:%u\n",
|
||||
info->nsid);
|
||||
status = -EINVAL;
|
||||
}
|
||||
|
|
@ -4126,13 +4126,13 @@ static int nvme_init_ns_head(struct nvme_ns *ns, struct nvme_ns_info *info)
|
|||
((ns->ctrl->subsys->cmic & NVME_CTRL_CMIC_MULTI_CTRL) &&
|
||||
info->is_shared)) {
|
||||
dev_err(ctrl->device,
|
||||
"ignoring nsid %d because of duplicate IDs\n",
|
||||
"ignoring nsid %u because of duplicate IDs\n",
|
||||
info->nsid);
|
||||
return ret;
|
||||
}
|
||||
|
||||
dev_err(ctrl->device,
|
||||
"clearing duplicate IDs for nsid %d\n", info->nsid);
|
||||
"clearing duplicate IDs for nsid %u\n", info->nsid);
|
||||
dev_err(ctrl->device,
|
||||
"use of /dev/disk/by-id/ may cause data corruption\n");
|
||||
memset(&info->ids.nguid, 0, sizeof(info->ids.nguid));
|
||||
|
|
@ -4147,7 +4147,7 @@ static int nvme_init_ns_head(struct nvme_ns *ns, struct nvme_ns_info *info)
|
|||
ret = nvme_subsys_check_duplicate_ids(ctrl->subsys, &info->ids);
|
||||
if (ret) {
|
||||
dev_err(ctrl->device,
|
||||
"duplicate IDs in subsystem for nsid %d\n",
|
||||
"duplicate IDs in subsystem for nsid %u\n",
|
||||
info->nsid);
|
||||
goto out_unlock;
|
||||
}
|
||||
|
|
@ -4161,20 +4161,20 @@ static int nvme_init_ns_head(struct nvme_ns *ns, struct nvme_ns_info *info)
|
|||
if ((!info->is_shared || !head->shared) &&
|
||||
!list_empty(&head->list)) {
|
||||
dev_err(ctrl->device,
|
||||
"Duplicate unshared namespace %d\n",
|
||||
"Duplicate unshared namespace %u\n",
|
||||
info->nsid);
|
||||
goto out_put_ns_head;
|
||||
}
|
||||
if (!nvme_ns_ids_equal(&head->ids, &info->ids)) {
|
||||
dev_err(ctrl->device,
|
||||
"IDs don't match for shared namespace %d\n",
|
||||
"IDs don't match for shared namespace %u\n",
|
||||
info->nsid);
|
||||
goto out_put_ns_head;
|
||||
}
|
||||
|
||||
if (!multipath) {
|
||||
dev_warn(ctrl->device,
|
||||
"Found shared namespace %d, but multipathing not supported.\n",
|
||||
"Found shared namespace %u, but multipathing not supported.\n",
|
||||
info->nsid);
|
||||
dev_warn_once(ctrl->device,
|
||||
"Shared namespace support requires core_nvme.multipath=Y.\n");
|
||||
|
|
@ -4423,7 +4423,7 @@ static void nvme_validate_ns(struct nvme_ns *ns, struct nvme_ns_info *info)
|
|||
|
||||
if (!nvme_ns_ids_equal(&ns->head->ids, &info->ids)) {
|
||||
dev_err(ns->ctrl->device,
|
||||
"identifiers changed for nsid %d\n", ns->head->ns_id);
|
||||
"identifiers changed for nsid %u\n", ns->head->ns_id);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
@ -4450,7 +4450,7 @@ static void nvme_scan_ns(struct nvme_ctrl *ctrl, unsigned nsid)
|
|||
|
||||
if (info.ids.csi != NVME_CSI_NVM && !nvme_multi_css(ctrl)) {
|
||||
dev_warn(ctrl->device,
|
||||
"command set not reported for nsid: %d\n", nsid);
|
||||
"command set not reported for nsid: %u\n", nsid);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ static DEVICE_ATTR_RO(eui);
|
|||
static ssize_t nsid_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
return sysfs_emit(buf, "%d\n", dev_to_ns_head(dev)->ns_id);
|
||||
return sysfs_emit(buf, "%u\n", dev_to_ns_head(dev)->ns_id);
|
||||
}
|
||||
static DEVICE_ATTR_RO(nsid);
|
||||
|
||||
|
|
|
|||
|
|
@ -48,12 +48,12 @@ int nvme_query_zone_info(struct nvme_ns *ns, unsigned lbaf,
|
|||
NVME_CMD_EFFECTS_CSUPP)) {
|
||||
if (test_and_clear_bit(NVME_NS_FORCE_RO, &ns->flags))
|
||||
dev_warn(ns->ctrl->device,
|
||||
"Zone Append supported for zoned namespace:%d. Remove read-only mode\n",
|
||||
"Zone Append supported for zoned namespace:%u. Remove read-only mode\n",
|
||||
ns->head->ns_id);
|
||||
} else {
|
||||
set_bit(NVME_NS_FORCE_RO, &ns->flags);
|
||||
dev_warn(ns->ctrl->device,
|
||||
"Zone Append not supported for zoned namespace:%d. Forcing to read-only mode\n",
|
||||
"Zone Append not supported for zoned namespace:%u. Forcing to read-only mode\n",
|
||||
ns->head->ns_id);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user