linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 ndctl] ndctl/namespace: Fix enable-namespace error for seed namespaces
@ 2020-01-13  4:24 Santosh Sivaraj
  2020-02-20  3:53 ` Santosh Sivaraj
  0 siblings, 1 reply; 3+ messages in thread
From: Santosh Sivaraj @ 2020-01-13  4:24 UTC (permalink / raw)
  To: linux-nvdimm, Dan Williams; +Cc: harish

'ndctl enable-namespace all' tries to enable seed namespaces too, which results
in a error like

libndctl: ndctl_namespace_enable: namespace1.0: failed to enable

Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
---
 ndctl/lib/libndctl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index 6596f94..9c6ccb8 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -4010,11 +4010,16 @@ NDCTL_EXPORT int ndctl_namespace_enable(struct ndctl_namespace *ndns)
 	const char *devname = ndctl_namespace_get_devname(ndns);
 	struct ndctl_ctx *ctx = ndctl_namespace_get_ctx(ndns);
 	struct ndctl_region *region = ndns->region;
+	unsigned long long size = ndctl_namespace_get_size(ndns);
 	int rc;
 
 	if (ndctl_namespace_is_enabled(ndns))
 		return 0;
 
+	/* Don't try to enable idle namespace (no capacity allocated) */
+	if (size == 0)
+		return -ENXIO;
+
 	rc = ndctl_bind(ctx, ndns->module, devname);
 
 	/*
-- 
2.24.1
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 ndctl] ndctl/namespace: Fix enable-namespace error for seed namespaces
  2020-01-13  4:24 [PATCH v2 ndctl] ndctl/namespace: Fix enable-namespace error for seed namespaces Santosh Sivaraj
@ 2020-02-20  3:53 ` Santosh Sivaraj
  2020-02-20  4:08   ` Dan Williams
  0 siblings, 1 reply; 3+ messages in thread
From: Santosh Sivaraj @ 2020-02-20  3:53 UTC (permalink / raw)
  To: linux-nvdimm, Dan Williams

Santosh Sivaraj <santosh@fossix.org> writes:

> 'ndctl enable-namespace all' tries to enable seed namespaces too, which results
> in a error like
>
> libndctl: ndctl_namespace_enable: namespace1.0: failed to enable

Dan/Vishal,

Will this patch be taken in the next ndctl release?

Thanks,
Santosh

>
> Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
> ---
>  ndctl/lib/libndctl.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
> index 6596f94..9c6ccb8 100644
> --- a/ndctl/lib/libndctl.c
> +++ b/ndctl/lib/libndctl.c
> @@ -4010,11 +4010,16 @@ NDCTL_EXPORT int ndctl_namespace_enable(struct ndctl_namespace *ndns)
>  	const char *devname = ndctl_namespace_get_devname(ndns);
>  	struct ndctl_ctx *ctx = ndctl_namespace_get_ctx(ndns);
>  	struct ndctl_region *region = ndns->region;
> +	unsigned long long size = ndctl_namespace_get_size(ndns);
>  	int rc;
>  
>  	if (ndctl_namespace_is_enabled(ndns))
>  		return 0;
>  
> +	/* Don't try to enable idle namespace (no capacity allocated) */
> +	if (size == 0)
> +		return -ENXIO;
> +
>  	rc = ndctl_bind(ctx, ndns->module, devname);
>  
>  	/*
> -- 
> 2.24.1
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 ndctl] ndctl/namespace: Fix enable-namespace error for seed namespaces
  2020-02-20  3:53 ` Santosh Sivaraj
@ 2020-02-20  4:08   ` Dan Williams
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Williams @ 2020-02-20  4:08 UTC (permalink / raw)
  To: Santosh Sivaraj; +Cc: linux-nvdimm

On Wed, Feb 19, 2020 at 7:53 PM Santosh Sivaraj <santosh@fossix.org> wrote:
>
> Santosh Sivaraj <santosh@fossix.org> writes:
>
> > 'ndctl enable-namespace all' tries to enable seed namespaces too, which results
> > in a error like
> >
> > libndctl: ndctl_namespace_enable: namespace1.0: failed to enable
>
> Dan/Vishal,
>
> Will this patch be taken in the next ndctl release?

Thanks for the reminder. I've picked this up.
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-20  4:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-13  4:24 [PATCH v2 ndctl] ndctl/namespace: Fix enable-namespace error for seed namespaces Santosh Sivaraj
2020-02-20  3:53 ` Santosh Sivaraj
2020-02-20  4:08   ` Dan Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).