nvmet: don't try to add ns to p2p map unless it actually uses it
authorSagi Grimberg <sagi@grimberg.me>
Fri, 2 Nov 2018 23:12:21 +0000 (16:12 -0700)
committerJens Axboe <axboe@kernel.dk>
Fri, 9 Nov 2018 13:14:47 +0000 (06:14 -0700)
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@grimberg.me>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/target/core.c

index f4efe289dc7bc2caa8ce3c2a1a44b97e66cd0324..a5f9bbce863f42dcff6c23759801fa9c48d0b210 100644 (file)
@@ -420,7 +420,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) {