Skip to contentSkip to conversation

nvmet: print a hint while rejecting NSID 0 or 0xffffffff

PATCH New Mikhail Skorzhinskii 6 participants 8 messages Jul 4, 2019 – Jul 9, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvmet: print a hint while rejecting NSID 0 or 0xffffffff

Adding this hint for the sake of convenience.

It was spotted that a few times people spent some time before understanding what is exactly wrong in configuration process. This should save a few time in such situations, especially for people who is not very confident with NVMe requirements.

Signed-off-by Mikhail Skorzhinskii <mskorzhinskiy at solarflare.com>
---
 drivers/nvme/target/configfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvme/target/configfs.c +3 -1
index 08dd5af357f7..cd52b9f15376 100644
@@ -588,8 +588,10 @@ static struct config_group *nvmet_ns_make(struct config_group *group,
 		goto out;
 
 	ret = -EINVAL;
-	if (nsid == 0 || nsid == NVME_NSID_ALL)
+	if (nsid == 0 || nsid == NVME_NSID_ALL) {
+		pr_err("invalid nsid %#x", nsid);
 		goto out;
+	}
 
 	ret = -ENOMEM;
 	ns = nvmet_ns_alloc(subsys, nsid);
Signature · 1 line
2.16.4
#1 lore raw

PATCH 1/1 nvmet: print a hint while rejecting NSID 0 or 0xffffffff

Quoted 18 lines · Mikhail Skorzhinskii

Adding this hint for the sake of convenience.

It was spotted that a few times people spent some time before understanding what is exactly wrong in configuration process. This should save a few time in such situations, especially for people who is not very confident with NVMe requirements.

Signed-off-by Mikhail Skorzhinskii <mskorzhinskiy at solarflare.com>
---
  drivers/nvme/target/configfs.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvme/target/configfs.c +0 -0
index 08dd5af357f7..cd52b9f15376 100644
@@ -588,8 +588,10 @@ static struct config_group *nvmet_ns_make(struct config_group *group,
  		goto out;

drivers/nvme/target/configfs.c static struct config_group *nvmet_ns_make(struct config_group *group, · line 597

Quoted 10 lines
drivers/nvme/target/configfs.c +3 -1
 
  	ret = -EINVAL;
-	if (nsid == 0 || nsid == NVME_NSID_ALL)
+	if (nsid == 0 || nsid == NVME_NSID_ALL) {
+		pr_err("invalid nsid %#x", nsid);
  		goto out;
+	}
 
  	ret = -ENOMEM;
  	ns = nvmet_ns_alloc(subsys, nsid);

If Linux users want to figure out which code reported an error message they sometimes run grep over the Linux kernel source code. Seeing the above message makes me wonder whether enough context information is provided to allow users to figure out unambiguously which code reported the error message? Have you considered to include the function name in the error message?

Thanks,

Bart.

#2 lore raw

PATCH 1/1 nvmet: print a hint while rejecting NSID 0 or 0xffffffff

Quoted 30 lines · Bart Van Assche
Quoted 29 lines · Mikhail Skorzhinskii

Adding this hint for the sake of convenience.

It was spotted that a few times people spent some time before understanding
what is exactly wrong in configuration process. This should save a few time
in such situations, especially for people who is not very confident with NVMe requirements.

Signed-off-by Mikhail Skorzhinskii <mskorzhinskiy at solarflare.com>

---
? drivers/nvme/target/configfs.c | 4 +++-
? 1 file changed, 3 insertions(+), 1 deletion(-)

drivers/nvme/target/configfs.c +3 -1
index 08dd5af357f7..cd52b9f15376 100644
@@ -588,8 +588,10 @@ static struct config_group *nvmet_ns_make(struct 
 config_group *group,
 ????????? goto out;
 ????? ret = -EINVAL;
-??? if (nsid == 0 || nsid == NVME_NSID_ALL)
+??? if (nsid == 0 || nsid == NVME_NSID_ALL) {
+??????? pr_err("invalid nsid %#x", nsid);
 ????????? goto out;
+??? }
 ????? ret = -ENOMEM;
Quoted 8 lines

drivers/nvme/target/configfs.c static struct config_group *nvmet_ns_make(struct · line 596

Quoted 1 line
drivers/nvme/target/configfs.c +0 -0
 ????? ns = nvmet_ns_alloc(subsys, nsid);

If Linux users want to figure out which code reported an error message they sometimes run grep over the Linux kernel source code. Seeing the above message makes me wonder whether enough context information is provided to allow users to figure out unambiguously which code reported the error message? Have you considered to include the function name in the error message?

It would also be nice to see a device or namespace name, if available.

Quoted 11 lines

Thanks,

Bart.

_______________________________________________
Linux-nvme mailing list
Linux-nvme at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

#3 lore raw

PATCH 1/1 nvmet: print a hint while rejecting NSID 0 or 0xffffffff

In reply to Bart Van Assche
Quoted 30 lines · Bart Van Assche
Quoted 29 lines · Mikhail Skorzhinskii

Adding this hint for the sake of convenience.

It was spotted that a few times people spent some time before understanding
what is exactly wrong in configuration process. This should save a few time
in such situations, especially for people who is not very confident with NVMe requirements.

Signed-off-by Mikhail Skorzhinskii <mskorzhinskiy at solarflare.com>

---
? drivers/nvme/target/configfs.c | 4 +++-
? 1 file changed, 3 insertions(+), 1 deletion(-)

drivers/nvme/target/configfs.c +3 -1
index 08dd5af357f7..cd52b9f15376 100644
@@ -588,8 +588,10 @@ static struct config_group *nvmet_ns_make(struct 
 config_group *group,
 ????????? goto out;
 ????? ret = -EINVAL;
-??? if (nsid == 0 || nsid == NVME_NSID_ALL)
+??? if (nsid == 0 || nsid == NVME_NSID_ALL) {
+??????? pr_err("invalid nsid %#x", nsid);
 ????????? goto out;
+??? }
 ????? ret = -ENOMEM;
Quoted 8 lines

drivers/nvme/target/configfs.c static struct config_group *nvmet_ns_make(struct · line 596

Quoted 1 line
drivers/nvme/target/configfs.c +0 -0
 ????? ns = nvmet_ns_alloc(subsys, nsid);

If Linux users want to figure out which code reported an error message they sometimes run grep over the Linux kernel source code. Seeing the above message makes me wonder whether enough context information is provided to allow users to figure out unambiguously which code reported the error message? Have you considered to include the function name in the error message

It looks like 'pr_fmt' is set in this file so the module name will at least be identified.

Quoted 10 lines

Thanks,

Bart.

_______________________________________________
Linux-nvme mailing list
Linux-nvme at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

#4 lore raw

PATCH 1/1 nvmet: print a hint while rejecting NSID 0 or 0xffffffff

In reply to Bart Van Assche
Quoted 6 lines · Bart Van Assche

If Linux users want to figure out which code reported an error message they sometimes run grep over the Linux kernel source code. Seeing the above message makes me wonder whether enough context information is provided to allow users to figure out unambiguously which code reported the error message? Have you considered to include the function name in the error message?

Bart,

I can see some pr_err() with __func__ being printed out in other drivers, but I just wonder if error messages with the function name itself have been a tradition for the linux kernel project.

Is there somewhere to find out these kind of standard or something? Or If you don't mind, can I ask your advices based on your experience on kernel?

Thanks,

maintainer
#5 lore raw

PATCH 1/1 nvmet: print a hint while rejecting NSID 0 or 0xffffffff

In reply to Bart Van Assche
Quoted 16 lines
Quoted 16 lines
drivers/nvme/target/configfs.c +3 -1
index 08dd5af357f7..cd52b9f15376 100644
@@ -588,8 +588,10 @@ static struct config_group *nvmet_ns_make(struct 
 config_group *group,
 ????????? goto out;
 ????? ret = -EINVAL;
-??? if (nsid == 0 || nsid == NVME_NSID_ALL)
+??? if (nsid == 0 || nsid == NVME_NSID_ALL) {
+??????? pr_err("invalid nsid %#x", nsid);
 ????????? goto out;
+??? }
 ????? ret = -ENOMEM;
Quoted 8 lines

drivers/nvme/target/configfs.c static struct config_group *nvmet_ns_make(struct · line 596

Quoted 1 line
drivers/nvme/target/configfs.c +0 -0
 ????? ns = nvmet_ns_alloc(subsys, nsid);

If Linux users want to figure out which code reported an error message they sometimes run grep over the Linux kernel source code. Seeing the above message makes me wonder whether enough context information is provided to allow users to figure out unambiguously which code reported the error message? Have you considered to include the function name in the error message?

I don't think we need that, the same argument can be made for almost any error print, and its pretty obvious that this is the ns creation failure.

The location can be retrieved from:
grep -rIn "invalid nsid" drivers/nvme/target/