From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH 1/9] nvme: don't hold nvmf_transports_rwsem for more than transport lookups
Date: Fri, 1 Jun 2018 09:11:20 +0200 [thread overview]
Message-ID: <20180601071128.7630-2-hch@lst.de> (raw)
In-Reply-To: <20180601071128.7630-1-hch@lst.de>
From: Johannes Thumshirn <jthumshirn@suse.de>
Only take nvmf_transports_rwsem when doing a lookup of registered
transports, so that a blocking ->create_ctrl doesn't prevent other
actions on /dev/nvme-fabrics.
Signed-off-by: Johannes Thumshirn <jthumshirn at suse.de>
[hch: increased lock hold time a bit to be safe, added a comment
and updated the changelog]
Signed-off-by: Christoph Hellwig <hch at lst.de>
---
drivers/nvme/host/fabrics.c | 3 ++-
drivers/nvme/host/fabrics.h | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 5f5f7067c41d..fa32c1216409 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -952,6 +952,7 @@ nvmf_create_ctrl(struct device *dev, const char *buf, size_t count)
ret = -EBUSY;
goto out_unlock;
}
+ up_read(&nvmf_transports_rwsem);
ret = nvmf_check_required_opts(opts, ops->required_opts);
if (ret)
@@ -968,11 +969,11 @@ nvmf_create_ctrl(struct device *dev, const char *buf, size_t count)
}
module_put(ops->module);
- up_read(&nvmf_transports_rwsem);
return ctrl;
out_module_put:
module_put(ops->module);
+ goto out_free_opts;
out_unlock:
up_read(&nvmf_transports_rwsem);
out_free_opts:
diff --git a/drivers/nvme/host/fabrics.h b/drivers/nvme/host/fabrics.h
index 0cf0460a5c92..7491a0bbf711 100644
--- a/drivers/nvme/host/fabrics.h
+++ b/drivers/nvme/host/fabrics.h
@@ -124,6 +124,9 @@ struct nvmf_ctrl_options {
* 1. At minimum, 'required_opts' and 'allowed_opts' should
* be set to the same enum parsing options defined earlier.
* 2. create_ctrl() must be defined (even if it does nothing)
+ * 3. struct nvmf_transport_ops must be statically allocated in the
+ * modules .bss section so that a pure module_get on @module
+ * prevents the memory from beeing freed.
*/
struct nvmf_transport_ops {
struct list_head entry;
--
2.17.0
next prev parent reply other threads:[~2018-06-01 7:11 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-01 7:11 draft ANA support v2 Christoph Hellwig
2018-06-01 7:11 ` Christoph Hellwig [this message]
2018-06-03 12:26 ` [PATCH 1/9] nvme: don't hold nvmf_transports_rwsem for more than transport lookups Sagi Grimberg
2018-06-04 6:30 ` Hannes Reinecke
2018-06-01 7:11 ` [PATCH 2/9] nvme.h: add ANA definitions Christoph Hellwig
2018-06-03 12:27 ` Sagi Grimberg
2018-06-04 6:30 ` Hannes Reinecke
2018-06-04 11:58 ` Johannes Thumshirn
2018-06-01 7:11 ` [PATCH 3/9] nvme: add support for the log specific field Christoph Hellwig
2018-06-03 12:27 ` Sagi Grimberg
2018-06-04 6:31 ` Hannes Reinecke
2018-06-04 11:59 ` Johannes Thumshirn
2018-06-01 7:11 ` [PATCH 4/9] nvme: always failover on path or transport errors Christoph Hellwig
2018-06-01 15:27 ` Mike Snitzer
2018-06-04 6:29 ` Christoph Hellwig
2018-06-04 12:01 ` Johannes Thumshirn
2018-06-04 12:23 ` Mike Snitzer
2018-06-03 12:28 ` Sagi Grimberg
2018-06-04 6:32 ` Hannes Reinecke
2018-06-01 7:11 ` [PATCH 5/9] nvme: add ANA support Christoph Hellwig
2018-06-04 6:36 ` Hannes Reinecke
2018-06-04 7:03 ` Christoph Hellwig
2018-06-04 9:51 ` Hannes Reinecke
2018-06-04 12:31 ` Mike Snitzer
2018-06-04 13:37 ` Hannes Reinecke
2018-06-06 12:01 ` Popuri, Sriram
2018-06-06 12:13 ` Christoph Hellwig
2018-06-06 12:27 ` Popuri, Sriram
2018-06-06 12:50 ` Christoph Hellwig
2018-06-01 7:11 ` [PATCH 6/9] nvmet: track and limit the number of namespaces per subsystem Christoph Hellwig
2018-06-04 6:35 ` Hannes Reinecke
2018-06-04 12:04 ` Johannes Thumshirn
2018-06-01 7:11 ` [PATCH 7/9] nvmet: add minimal ANA support Christoph Hellwig
2018-06-04 6:41 ` Hannes Reinecke
2018-06-04 12:25 ` Johannes Thumshirn
2018-06-04 12:55 ` Christoph Hellwig
2018-06-01 7:11 ` [PATCH 8/9] nvmet: support configuring additional ANA groups Christoph Hellwig
2018-06-04 6:42 ` Hannes Reinecke
2018-06-04 6:53 ` Christoph Hellwig
2018-06-04 9:48 ` Hannes Reinecke
2018-06-01 7:11 ` [PATCH 9/9] nvmet: make ANATT configurable Christoph Hellwig
2018-06-04 10:21 ` Hannes Reinecke
2018-06-04 12:11 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180601071128.7630-2-hch@lst.de \
--to=hch@lst.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).