[PATCH 3/3] nvmet: do not allow to create a subsystem with the discovery NQN
Hannes Reinecke
hare at suse.de
Mon Mar 14 03:53:33 PDT 2022
configfs will only protect us against duplication of subsystem NQNs,
but discovery subsystems might have two NQNs, the standard discovery NQN
(which will be used as the configfs directory name), and the additional
unique subsystem NQN.
Signed-off-by: Hannes Reinecke <hare at suse.de>
---
drivers/nvme/target/configfs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index 58124abdbf62..617ab027ae2f 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -1434,6 +1434,9 @@ static struct config_group *nvmet_subsys_make(struct config_group *group,
return ERR_PTR(-EINVAL);
}
+ if (sysfs_streq(name, nvmet_disc_subsys->subsysnqn))
+ return ERR_PTR(-EBUSY);
+
subsys = nvmet_subsys_alloc(name, NVME_NQN_NVME);
if (IS_ERR(subsys))
return ERR_CAST(subsys);
--
2.29.2
More information about the Linux-nvme
mailing list