linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvme: make nvmf_register_transport require a create_ctrl callback
@ 2017-01-26 15:22 Johannes Thumshirn
  2017-01-26 16:30 ` Sagi Grimberg
  2017-01-26 17:45 ` kbuild test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2017-01-26 15:22 UTC (permalink / raw)
  To: Christoph Hellwig, Sagi Grimberg, Keith Busch
  Cc: Jens Axboe, Linux NVMe Mailinglist, Linux Kernel Mailinglist,
	Johannes Thumshirn

nvmf_create_ctrl() relys on the presence of a create_crtl callback in the
registered nvmf_transport_ops, so make nvmf_register_transport require one.

Update the available call-sites as well to reflect these changes.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 drivers/nvme/host/fabrics.c | 7 ++++++-
 drivers/nvme/host/fabrics.h | 2 +-
 drivers/nvme/host/fc.c      | 3 +--
 drivers/nvme/host/rdma.c    | 3 +--
 drivers/nvme/target/loop.c  | 3 +--
 5 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 916d136..5b7386f 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -480,11 +480,16 @@ int nvmf_connect_io_queue(struct nvme_ctrl *ctrl, u16 qid)
  * being implemented to the common NVMe fabrics library. Part of
  * the overall init sequence of starting up a fabrics driver.
  */
-void nvmf_register_transport(struct nvmf_transport_ops *ops)
+int nvmf_register_transport(struct nvmf_transport_ops *ops)
 {
+	if (!ops->create_ctrl)
+		return -EINVAL;
+
 	mutex_lock(&nvmf_transports_mutex);
 	list_add_tail(&ops->entry, &nvmf_transports);
 	mutex_unlock(&nvmf_transports_mutex);
+
+	return 0;
 }
 EXPORT_SYMBOL_GPL(nvmf_register_transport);
 
diff --git a/drivers/nvme/host/fabrics.h b/drivers/nvme/host/fabrics.h
index 924145c9..1560181 100644
--- a/drivers/nvme/host/fabrics.h
+++ b/drivers/nvme/host/fabrics.h
@@ -128,7 +128,7 @@ struct nvmf_transport_ops {
 int nvmf_reg_write32(struct nvme_ctrl *ctrl, u32 off, u32 val);
 int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl);
 int nvmf_connect_io_queue(struct nvme_ctrl *ctrl, u16 qid);
-void nvmf_register_transport(struct nvmf_transport_ops *ops);
+int nvmf_register_transport(struct nvmf_transport_ops *ops);
 void nvmf_unregister_transport(struct nvmf_transport_ops *ops);
 void nvmf_free_options(struct nvmf_ctrl_options *opts);
 const char *nvmf_get_subsysnqn(struct nvme_ctrl *ctrl);
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index fcc9dcf..2912963 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -2562,8 +2562,7 @@ static int __init nvme_fc_init_module(void)
 	if (!nvme_fc_wq)
 		return -ENOMEM;
 
-	nvmf_register_transport(&nvme_fc_transport);
-	return 0;
+	return nvmf_register_transport(&nvme_fc_transport);
 }
 
 static void __exit nvme_fc_exit_module(void)
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 557f29b..80f3695 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -2063,8 +2063,7 @@ static int __init nvme_rdma_init_module(void)
 		return ret;
 	}
 
-	nvmf_register_transport(&nvme_rdma_transport);
-	return 0;
+	return = nvmf_register_transport(&nvme_rdma_transport);
 }
 
 static void __exit nvme_rdma_cleanup_module(void)
diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
index 9aaa700..07f1cb8 100644
--- a/drivers/nvme/target/loop.c
+++ b/drivers/nvme/target/loop.c
@@ -724,8 +724,7 @@ static int __init nvme_loop_init_module(void)
 	ret = nvmet_register_transport(&nvme_loop_ops);
 	if (ret)
 		return ret;
-	nvmf_register_transport(&nvme_loop_transport);
-	return 0;
+	return nvmf_register_transport(&nvme_loop_transport);
 }
 
 static void __exit nvme_loop_cleanup_module(void)
-- 
1.8.5.6

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

* Re: [PATCH] nvme: make nvmf_register_transport require a create_ctrl callback
  2017-01-26 15:22 [PATCH] nvme: make nvmf_register_transport require a create_ctrl callback Johannes Thumshirn
@ 2017-01-26 16:30 ` Sagi Grimberg
  2017-01-27  8:00   ` Johannes Thumshirn
  2017-01-26 17:45 ` kbuild test robot
  1 sibling, 1 reply; 4+ messages in thread
From: Sagi Grimberg @ 2017-01-26 16:30 UTC (permalink / raw)
  To: Johannes Thumshirn, Christoph Hellwig, Keith Busch
  Cc: Jens Axboe, Linux NVMe Mailinglist, Linux Kernel Mailinglist


>  static void __exit nvme_fc_exit_module(void)
> diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
> index 557f29b..80f3695 100644
> --- a/drivers/nvme/host/rdma.c
> +++ b/drivers/nvme/host/rdma.c
> @@ -2063,8 +2063,7 @@ static int __init nvme_rdma_init_module(void)
>  		return ret;
>  	}
>
> -	nvmf_register_transport(&nvme_rdma_transport);
> -	return 0;
> +	return = nvmf_register_transport(&nvme_rdma_transport);

??

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

* Re: [PATCH] nvme: make nvmf_register_transport require a create_ctrl callback
  2017-01-26 15:22 [PATCH] nvme: make nvmf_register_transport require a create_ctrl callback Johannes Thumshirn
  2017-01-26 16:30 ` Sagi Grimberg
@ 2017-01-26 17:45 ` kbuild test robot
  1 sibling, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2017-01-26 17:45 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: kbuild-all, Christoph Hellwig, Sagi Grimberg, Keith Busch,
	Jens Axboe, Linux NVMe Mailinglist, Linux Kernel Mailinglist,
	Johannes Thumshirn

[-- Attachment #1: Type: text/plain, Size: 1326 bytes --]

Hi Johannes,

[auto build test ERROR on block/for-next]
[also build test ERROR on v4.10-rc5 next-20170125]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Johannes-Thumshirn/nvme-make-nvmf_register_transport-require-a-create_ctrl-callback/20170126-234702
base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 6.2.0
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=ia64 

All error/warnings (new ones prefixed by >>):


vim +2066 drivers/nvme/host/rdma.c

  2060		ret = ib_register_client(&nvme_rdma_ib_client);
  2061		if (ret) {
  2062			destroy_workqueue(nvme_rdma_wq);
  2063			return ret;
  2064		}
  2065	
> 2066		return = nvmf_register_transport(&nvme_rdma_transport);
> 2067	}
  2068	
  2069	static void __exit nvme_rdma_cleanup_module(void)
  2070	{

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 45519 bytes --]

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

* Re: [PATCH] nvme: make nvmf_register_transport require a create_ctrl callback
  2017-01-26 16:30 ` Sagi Grimberg
@ 2017-01-27  8:00   ` Johannes Thumshirn
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2017-01-27  8:00 UTC (permalink / raw)
  To: Sagi Grimberg
  Cc: Christoph Hellwig, Keith Busch, Jens Axboe,
	Linux NVMe Mailinglist, Linux Kernel Mailinglist

On Thu, Jan 26, 2017 at 06:30:47PM +0200, Sagi Grimberg wrote:
> 
> > static void __exit nvme_fc_exit_module(void)
> >diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
> >index 557f29b..80f3695 100644
> >--- a/drivers/nvme/host/rdma.c
> >+++ b/drivers/nvme/host/rdma.c
> >@@ -2063,8 +2063,7 @@ static int __init nvme_rdma_init_module(void)
> > 		return ret;
> > 	}
> >
> >-	nvmf_register_transport(&nvme_rdma_transport);
> >-	return 0;
> >+	return = nvmf_register_transport(&nvme_rdma_transport);

Gah typo and I had only fc enabled in my .config.

Sorry.

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

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

end of thread, other threads:[~2017-01-27  8:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-26 15:22 [PATCH] nvme: make nvmf_register_transport require a create_ctrl callback Johannes Thumshirn
2017-01-26 16:30 ` Sagi Grimberg
2017-01-27  8:00   ` Johannes Thumshirn
2017-01-26 17:45 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).