nvmet: allow identical cntlid_min and cntlid_max settings
authorGuixin Liu <kanie@linux.alibaba.com>
Wed, 13 Dec 2023 06:32:49 +0000 (14:32 +0800)
committerKeith Busch <kbusch@kernel.org>
Wed, 13 Dec 2023 22:53:33 +0000 (14:53 -0800)
When the user wants to restrict to only creating one controller,
they can set cntlid_min and cntlid_max to the same value.

Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/target/configfs.c

index e307a044b1a1bc1fee0b7ca4a87c3be84a828d15..bd514d4c4a5b3bd5d377b9aff425db793420c453 100644 (file)
@@ -1274,7 +1274,7 @@ static ssize_t nvmet_subsys_attr_cntlid_min_store(struct config_item *item,
                return -EINVAL;
 
        down_write(&nvmet_config_sem);
-       if (cntlid_min >= to_subsys(item)->cntlid_max)
+       if (cntlid_min > to_subsys(item)->cntlid_max)
                goto out_unlock;
        to_subsys(item)->cntlid_min = cntlid_min;
        up_write(&nvmet_config_sem);
@@ -1304,7 +1304,7 @@ static ssize_t nvmet_subsys_attr_cntlid_max_store(struct config_item *item,
                return -EINVAL;
 
        down_write(&nvmet_config_sem);
-       if (cntlid_max <= to_subsys(item)->cntlid_min)
+       if (cntlid_max < to_subsys(item)->cntlid_min)
                goto out_unlock;
        to_subsys(item)->cntlid_max = cntlid_max;
        up_write(&nvmet_config_sem);