public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] nvme: warn only once for legacy uuid attribute
@ 2023-07-12 14:59 Keith Busch
  2023-07-12 15:02 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Keith Busch @ 2023-07-12 14:59 UTC (permalink / raw)
  To: linux-nvme, hch, sagi; +Cc: Keith Busch, Johannes Thumshirn, Breno Leitao

From: Keith Busch <kbusch@kernel.org>

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 <johannes.thumshirn@wdc.com>
Reported-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 drivers/nvme/host/core.c  | 7 +++++++
 drivers/nvme/host/sysfs.c | 8 +++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 47d7ba2827ff2..6984205b3514f 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -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:
diff --git a/drivers/nvme/host/sysfs.c b/drivers/nvme/host/sysfs.c
index 45e91811f905c..0c636d873e058 100644
--- a/drivers/nvme/host/sysfs.c
+++ b/drivers/nvme/host/sysfs.c
@@ -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);
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nvme: warn only once for legacy uuid attribute
  2023-07-12 14:59 [PATCH] nvme: warn only once for legacy uuid attribute Keith Busch
@ 2023-07-12 15:02 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2023-07-12 15:02 UTC (permalink / raw)
  To: Keith Busch
  Cc: linux-nvme, hch, sagi, Keith Busch, Johannes Thumshirn,
	Breno Leitao

On Wed, Jul 12, 2023 at 07:59:21AM -0700, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
> 
> 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.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-12 15:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-12 14:59 [PATCH] nvme: warn only once for legacy uuid attribute Keith Busch
2023-07-12 15:02 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox