From: sagi@grimberg.me (Sagi Grimberg)
Subject: [PATCH 1/3] nvmet: delete controllers deletion upon subsystem release
Date: Mon, 5 Dec 2016 13:09:04 +0200 [thread overview]
Message-ID: <1480936146-6406-2-git-send-email-sagi@grimberg.me> (raw)
In-Reply-To: <1480936146-6406-1-git-send-email-sagi@grimberg.me>
No reason for them to be kept around if we are
deleting the subsystem, so instead of passively
wait for the host to disconnect, actively delete
the controllers.
Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
---
drivers/nvme/target/configfs.c | 1 +
drivers/nvme/target/core.c | 10 ++++++++++
drivers/nvme/target/nvmet.h | 1 +
3 files changed, 12 insertions(+)
diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index d0f60c36d576..634a2d780e16 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -633,6 +633,7 @@ static void nvmet_subsys_release(struct config_item *item)
{
struct nvmet_subsys *subsys = to_subsys(item);
+ nvmet_subsys_del_ctrls(subsys);
nvmet_subsys_put(subsys);
}
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index b1d66ed655c9..4a367549eb93 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -935,6 +935,16 @@ static void nvmet_subsys_free(struct kref *ref)
kfree(subsys);
}
+void nvmet_subsys_del_ctrls(struct nvmet_subsys *subsys)
+{
+ struct nvmet_ctrl *ctrl;
+
+ mutex_lock(&subsys->lock);
+ list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry)
+ ctrl->ops->delete_ctrl(ctrl);
+ mutex_unlock(&subsys->lock);
+}
+
void nvmet_subsys_put(struct nvmet_subsys *subsys)
{
kref_put(&subsys->ref, nvmet_subsys_free);
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 23d5eb1c944f..cc7ad06b43a7 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -282,6 +282,7 @@ void nvmet_ctrl_put(struct nvmet_ctrl *ctrl);
struct nvmet_subsys *nvmet_subsys_alloc(const char *subsysnqn,
enum nvme_subsys_type type);
void nvmet_subsys_put(struct nvmet_subsys *subsys);
+void nvmet_subsys_del_ctrls(struct nvmet_subsys *subsys);
struct nvmet_ns *nvmet_find_namespace(struct nvmet_ctrl *ctrl, __le32 nsid);
void nvmet_put_namespace(struct nvmet_ns *ns);
--
2.7.4
next prev parent reply other threads:[~2016-12-05 11:09 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-05 11:09 [PATCH 0/3] some useful fabrics patches Sagi Grimberg
2016-12-05 11:09 ` Sagi Grimberg [this message]
2016-12-05 11:39 ` [PATCH 1/3] nvmet: delete controllers deletion upon subsystem release Johannes Thumshirn
2016-12-05 14:08 ` Max Gurtovoy
2016-12-05 15:40 ` Christoph Hellwig
2016-12-05 17:08 ` Sagi Grimberg
2016-12-06 8:28 ` Christoph Hellwig
2016-12-05 11:09 ` [PATCH 2/3] nvmet: Make cntlid globally unique Sagi Grimberg
2016-12-05 11:38 ` Johannes Thumshirn
2016-12-05 14:08 ` Max Gurtovoy
2016-12-05 15:34 ` Christoph Hellwig
2016-12-05 17:06 ` Sagi Grimberg
2016-12-06 8:28 ` Christoph Hellwig
2016-12-06 23:23 ` J Freyensee
2016-12-05 11:09 ` [PATCH 3/3] nvme: Make controller state visible via sysfs Sagi Grimberg
2016-12-05 11:37 ` Johannes Thumshirn
2016-12-05 14:15 ` Max Gurtovoy
2016-12-05 17:05 ` Sagi Grimberg
2016-12-05 15:37 ` Christoph Hellwig
2016-12-05 17:06 ` Sagi Grimberg
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=1480936146-6406-2-git-send-email-sagi@grimberg.me \
--to=sagi@grimberg.me \
/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).