nvme: warn only once for legacy uuid attribute
PATCH 1/1 nvme: warn only once for legacy uuid attribute
From: Keith Busch <[email protected]>
Report the legacy fallback behavior for uuid attributes just once instead of logging repeated warnings for the same condition every time the attribute is read. The old behavior is too spamy on the kernel logs.
Cc Johannes Thumshirn <[email protected]>
Reported-by Breno Leitao <[email protected]>
Signed-off-by Keith Busch <[email protected]>
--- drivers/nvme/host/core.c | 7 +++++++ drivers/nvme/host/sysfs.c | 8 +++----- 2 files changed, 10 insertions(+), 5 deletions(-)
drivers/nvme/host/core.c +7 -0
@@ -3597,6 +3597,13 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, struct nvme_ns_info *info)nvme_mpath_add_disk (ns, info->anagrpid);nvme_fault_inject_init (&ns->fault_inject, ns->disk->disk_name); + +if (uuid_is_null (&info->ids.uuid) && +memchr_inv (info->ids.nguid,0 ,sizeof (info->ids.nguid))) { +dev_warn (ctrl->device, +"No UUID available providing old NGUID\n" ); + } +return ; out_cleanup_ns_from_list:
drivers/nvme/host/sysfs.c +3 -5
@@ -88,14 +88,12 @@ static ssize_t uuid_show(struct device *dev, struct device_attribute *attr, {struct nvme_ns_ids *ids = &dev_to_ns_head (dev)->ids; -/* For backward compatibility expose the NGUID to userspace if +/* +* For backward compatibility expose the NGUID to userspace if * we have no UUID set */ -if (uuid_is_null (&ids->uuid)) { -dev_warn_ratelimited (dev, -"No UUID available providing old NGUID\n" ); +if (uuid_is_null (&ids->uuid))return sysfs_emit (buf,"%pU\n" , ids->nguid); - }return sysfs_emit (buf,"%pU\n" , &ids->uuid); }static DEVICE_ATTR_RO (uuid);
Signature · 1 line
2.34.1
Christoph Hellwig
maintainerQuoted 5 lines · Keith Busch
From: Keith Busch <[email protected]>
Report the legacy fallback behavior for uuid attributes just once instead of logging repeated warnings for the same condition every time the attribute is read. The old behavior is too spamy on the kernel logs.
Warning on allocation just seems wrong - no uuid is perfectly fine. I think what we should do is warn once when reading the attribute and then never again.