* [PATCH] nvmet: access nr_namespaces under subsys lock
@ 2019-12-17 8:58 Chaitanya Kulkarni
2019-12-17 8:59 ` Chaitanya Kulkarni
0 siblings, 1 reply; 2+ messages in thread
From: Chaitanya Kulkarni @ 2019-12-17 8:58 UTC (permalink / raw)
To: linux-nvme; +Cc: hch, Chaitanya Kulkarni, sagi
The subsystem increments the number of namespaces which is protected by
the subsys->lock under nvmet_ns_enable(). Use a similar lock when
decrementing the same variable in nvmet_ns_disable().
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
drivers/nvme/target/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 28438b833c1b..706a7d50821a 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -611,9 +611,9 @@ void nvmet_ns_disable(struct nvmet_ns *ns)
wait_for_completion(&ns->disable_done);
percpu_ref_exit(&ns->ref);
+ subsys->nr_namespaces--;
mutex_lock(&subsys->lock);
- subsys->nr_namespaces--;
nvmet_ns_changed(subsys, ns->nsid);
nvmet_ns_dev_disable(ns);
out_unlock:
--
2.22.1
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-17 8:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-17 8:58 [PATCH] nvmet: access nr_namespaces under subsys lock Chaitanya Kulkarni
2019-12-17 8:59 ` Chaitanya Kulkarni
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).