Skip to contentSkip to conversation

nvmet: add safety check for subsystem lock during nvmet_ns_changed

PATCH New Max Gurtovoy 3 participants 3 messages Apr 2, 2019 – Apr 4, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvmet: add safety check for subsystem lock during nvmet_ns_changed

we need to make sure that subsystem lock is taken during ctrl's list traversing. nvmet_ns_changed function is not static and can be used from various callers simultaneously.

Signed-off-by Max Gurtovoy <maxg at mellanox.com>
---
 drivers/nvme/target/core.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/nvme/target/core.c +2 -0
index b3e765a..d42de97 100644
@@ -214,6 +214,8 @@ void nvmet_ns_changed(struct nvmet_subsys *subsys, u32 nsid)
 {
 	struct nvmet_ctrl *ctrl;
 
+	lockdep_assert_held(&subsys->lock);
+
 	list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) {
 		nvmet_add_to_changed_ns_log(ctrl, cpu_to_le32(nsid));
 		if (nvmet_aen_bit_disabled(ctrl, NVME_AEN_BIT_NS_ATTR))
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 nvmet: add safety check for subsystem lock during nvmet_ns_changed

Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn at suse.de>

Signature · 6 lines
Johannes Thumshirn                            SUSE Labs Filesystems
jthumshirn at suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG N?rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850