Skip to contentSkip to conversation

nvmet: don't try to add ns to p2p map unless it actually uses it

PATCH New Sagi Grimberg 3 participants 3 messages Nov 2, 2018 – Nov 7, 2018

Subsystems (2)
lore
Share & tools
lore

Sagi Grimberg

author maintainer
#0 lore raw

PATCH 1/1 nvmet: don't try to add ns to p2p map unless it actually uses it

Even without CONFIG_P2PDMA this results in a error print:
nvmet: no peer-to-peer memory is available that's supported by rxe0 and /dev/nullb0

Fixes c6925093d0b2 ("nvmet: Optionally use PCI P2P memory")
Signed-off-by Sagi Grimberg <sagi at grimberg.me>
---
 drivers/nvme/target/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/core.c +1 -1
index 0454fec46261..ae05afa19b4b 100644
@@ -422,7 +422,7 @@ static void nvmet_p2pmem_ns_add_p2p(struct nvmet_ctrl *ctrl,
 	struct pci_dev *p2p_dev;
 	int ret;
 
-	if (!ctrl->p2p_client)
+	if (!ctrl->p2p_client || !ns->use_p2pmem)
 		return;
 
 	if (ns->p2p_dev) {
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 nvmet: don't try to add ns to p2p map unless it actually uses it

Quoted 5 lines · Sagi Grimberg

Even without CONFIG_P2PDMA this results in a error print:
nvmet: no peer-to-peer memory is available that's supported by rxe0 and /dev/nullb0

Fixes c6925093d0b2 ("nvmet: Optionally use PCI P2P memory")
Signed-off-by Sagi Grimberg <sagi at grimberg.me>

Nice Catch. Thanks.

Reviewed-by Logan Gunthorpe <logang at deltatee.com>
Quoted 18 lines
---
 drivers/nvme/target/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/core.c +1 -1
index 0454fec46261..ae05afa19b4b 100644
@@ -422,7 +422,7 @@ static void nvmet_p2pmem_ns_add_p2p(struct nvmet_ctrl *ctrl,
 	struct pci_dev *p2p_dev;
 	int ret;
 
-	if (!ctrl->p2p_client)
+	if (!ctrl->p2p_client || !ns->use_p2pmem)
 		return;
 
 	if (ns->p2p_dev) {