Skip to contentSkip to conversation

nvmet: only check for filebacking on -ENOTBLK

PATCH New Hannes Reinecke 3 participants 3 messages Jul 25, 2018

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

PATCH 1/1 nvmet: only check for filebacking on -ENOTBLK

We only need to check for a file-backed namespace if nvmet_bdev_ns_enable() returns -ENOTBLK. For any other error it's pointless as the open() error will remain the same.

Signed-off-by Hannes Reinecke <hare at suse.com>
---
 drivers/nvme/target/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/core.c +1 -1
index ddd85715a00a..a216d7eb1050 100644
@@ -344,7 +344,7 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
 		goto out_unlock;
 
 	ret = nvmet_bdev_ns_enable(ns);
-	if (ret)
+	if (ret == -ENOTBLK)
 		ret = nvmet_file_ns_enable(ns);
 	if (ret)
 		goto out_unlock;
Signature · 1 line
2.12.3
#1 lore raw

PATCH 1/1 nvmet: only check for filebacking on -ENOTBLK

Thanks, looks good.

Reviewed-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>

From: Linux-nvme <[email protected]> on behalf of Hannes Reinecke <[email protected]>
Sent: Tuesday, July 24, 2018 11:34 PM
To: Christoph Hellwig
Cc: Keith Busch; Hannes Reinecke; Sagi Grimberg; linux-nvme at lists.infradead.org; Hannes Reinecke
Subject: [PATCH] nvmet: only check for filebacking on -ENOTBLK
?

We only need to check for a file-backed namespace if nvmet_bdev_ns_enable() returns -ENOTBLK. For any other error it's pointless as the open() error will remain the same.

Signed-off-by Hannes Reinecke <hare at suse.com>

---
?drivers/nvme/target/core.c | 2 +-
?1 file changed, 1 insertion(+), 1 deletion(-)

drivers/nvme/target/core.c +0 -0
index ddd85715a00a..a216d7eb1050 100644
@@ -344,7 +344,7 @@ int nvmet_ns_enable(struct nvmet_ns *ns)

???????????????? goto out_unlock;
?
???????? ret = nvmet_bdev_ns_enable(ns);
-?????? if (ret)
+?????? if (ret == -ENOTBLK)
???????????????? ret = nvmet_file_ns_enable(ns);
???????? if (ret)
???????????????? goto out_unlock;

Signature · 12 lines
2.12.3


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


Linux-nvme Info Page - lists.infradead.org
lists.infradead.org
To see the collection of prior postings to the list, visit the Linux-nvme Archives.. Using Linux-nvme: To post a message to all the list members, send email to linux-nvme at lists.infradead.org.