nvmet: never fail double namespace enablement
Subsystems (2)
PATCH 1/1 nvmet: never fail double namespace enablement
In case we create N namespaces while N < NVMET_MAX_NAMESPACES, we can perform "echo 1 > <nsid>/enable" as much as we want. In case N == NVMET_MAX_NAMESPACES we fail. Make sure we have the same flow for any N.
Signed-off-by Max Gurtovoy <maxg at mellanox.com>
--- drivers/nvme/target/core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/nvme/target/core.c +4 -3
@@ -496,13 +496,14 @@ int nvmet_ns_enable(struct nvmet_ns *ns)int ret;mutex_lock (&subsys->lock); - ret = -EMFILE ; -if (subsys->nr_namespaces ==NVMET_MAX_NAMESPACES ) - goto out_unlock; ret =0 ;if (ns->enabled) goto out_unlock; + ret = -EMFILE ; +if (subsys->nr_namespaces ==NVMET_MAX_NAMESPACES ) + goto out_unlock; + ret =nvmet_bdev_ns_enable (ns);if (ret == -ENOTBLK ) ret =nvmet_file_ns_enable (ns);
Signature · 1 line
1.8.3.1
PATCH 1/1 nvmet: never fail double namespace enablement
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
PATCH 1/1 nvmet: never fail double namespace enablement
In reply to Max GurtovoyThanks,
applied to nvme-5.2.