Message ID | 20191204095553.83209-1-santosh@fossix.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [ndctl] namespace/create: Don't create multiple namespace unless greedy | expand |
On Wed, Dec 4, 2019 at 1:56 AM Santosh Sivaraj <santosh@fossix.org> wrote: > > From: Vaibhav Jain <vaibhav@linux.ibm.com> > > Currently create-namespace creates two namespaces with the '-f' option > even without the greedy flag. This behavior got introduced by > c75f7236d. The earlier behaviour was to create one namespace even with > the '-f' flag. The earlier behavior: > > $ sudo ./ndctl/ndctl create-namespace -s 16M -f > [sudo] password for santosh: > { > "dev":"namespace1.14", > "mode":"fsdax", > "map":"dev", > "size":"14.00 MiB (14.68 MB)", > "uuid":"03f6b921-7684-4736-b2be-87f021996e52", > "sector_size":512, > "align":65536, > "blockdev":"pmem1.14" > } > > After greedy option was introduced: > > $ sudo ./ndctl/ndctl create-namespace -s 16M -f > { > "dev":"namespace1.8", > "mode":"fsdax", > "map":"dev", > "size":"14.00 MiB (14.68 MB)", > "uuid":"1a9d6610-558b-454e-8b95-76c6201798cb", > "sector_size":512, > "align":65536, > "blockdev":"pmem1.8" > } > { > "dev":"namespace0.3", > "mode":"fsdax", > "map":"dev", > "size":"14.00 MiB (14.68 MB)", > "uuid":"eed9d28b-69a2-4c7c-9503-24e8aee87b1e", > "sector_size":512, > "align":65536, > "blockdev":"pmem0.3" > } > > If no region or '-c' flag is specified bail out if the creation was successful. > > Fixes: c75f7236d (ndctl/namespace: add a --continue option to create namespaces greedily) > Signed-off-by: Santosh Sivaraj <santosh@fossix.org> > Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com> > --- > ndctl/namespace.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/ndctl/namespace.c b/ndctl/namespace.c > index 7fb0007..8098456 100644 > --- a/ndctl/namespace.c > +++ b/ndctl/namespace.c > @@ -1392,6 +1392,8 @@ static int do_xaction_namespace(const char *namespace, > if (force) { > if (rc) > saved_rc = rc; > + else if (!param.region) > + return rc; I see the bug, but the fix looks wrong to me. --force has no meaning in this case. I'd rather just clean-up --force to be ignored when neither "-c" nor "-e" are specified.
diff --git a/ndctl/namespace.c b/ndctl/namespace.c index 7fb0007..8098456 100644 --- a/ndctl/namespace.c +++ b/ndctl/namespace.c @@ -1392,6 +1392,8 @@ static int do_xaction_namespace(const char *namespace, if (force) { if (rc) saved_rc = rc; + else if (!param.region) + return rc; continue; } return rc;