linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
* [ndctl PATCH] ndctl: recover from failed namespace creation
@ 2018-09-11  8:31 oceanhehy
  2018-11-28  8:06 ` [External] " Ocean HY1 He
  2018-11-28 22:10 ` Dan Williams
  0 siblings, 2 replies; 3+ messages in thread
From: oceanhehy @ 2018-09-11  8:31 UTC (permalink / raw)
  To: dan.j.williams, vishal.l.verma, qi.fuli, linux-nvdimm; +Cc: Ocean He

From: Ocean He <hehy1@lenovo.com>

When namespace creation failure occurs, the consumed namespace (seed or 0th
idle) and pfn/dax seed would block next namespace creation. A recovery is
needed to handle this type failure.

A symptom example (section size is 128MB) based on kernel 4.19-rc2 and
ndctl v62:
	# ndctl create-namespace -r region1 -s 100m -t pmem -m fsdax
	{
	  "dev":"namespace1.0",
	  "mode":"fsdax",
	  "map":"dev",
	  "size":"96.00 MiB (100.66 MB)",
	  "uuid":"ef9a0556-a610-40b5-8c71-43991765a2cc",
	  "raw_uuid":"177b22e2-b7e8-482f-a063-2b8de876d979",
	  "sector_size":512,
	  "blockdev":"pmem1",
	  "numa_node":1
	}
	# ndctl create-namespace -r region1 -s 100m -t pmem -m fsdax
	libndctl: ndctl_pfn_enable: pfn1.1: failed to enable
	  Error: namespace1.1: failed to enable
	failed to create namespace: No such device or address
	# ndctl destroy-namespace namespace1.0 -f
	destroyed 1 namespace
	# ndctl create-namespace -r region1 -s 128m -t pmem -m fsdax
	failed to create namespace: Device or resource busy

Signed-off-by: Ocean He <hehy1@lenovo.com>
---
Additional information:
A kernel patch to fix this has been reviewed by Dan Williams, and he prefers
to handle it in ndctl directly.
https://www.spinics.net/lists/kernel/msg2901465.html

 ndctl/namespace.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 510553c..76ee2ed 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -393,6 +393,8 @@ static int setup_namespace(struct ndctl_region *region,
 			try(ndctl_pfn, set_align, pfn, p->align);
 		try(ndctl_pfn, set_namespace, pfn, ndns);
 		rc = ndctl_pfn_enable(pfn);
+		if (rc)
+			ndctl_pfn_set_namespace(pfn, NULL);
 	} else if (p->mode == NDCTL_NS_MODE_DAX) {
 		struct ndctl_dax *dax = ndctl_region_get_dax_seed(region);
 
@@ -402,6 +404,8 @@ static int setup_namespace(struct ndctl_region *region,
 		try(ndctl_dax, set_align, dax, p->align);
 		try(ndctl_dax, set_namespace, dax, ndns);
 		rc = ndctl_dax_enable(dax);
+		if (rc)
+			ndctl_dax_set_namespace(dax, NULL);
 	} else if (p->mode == NDCTL_NS_MODE_SAFE) {
 		struct ndctl_btt *btt = ndctl_region_get_btt_seed(region);
 
@@ -783,7 +787,13 @@ static int namespace_create(struct ndctl_region *region)
 		return -ENODEV;
 	}
 
-	return setup_namespace(region, ndns, &p);
+	rc = setup_namespace(region, ndns, &p);
+	if (rc) {
+		ndctl_namespace_set_enforce_mode(ndns, NDCTL_NS_MODE_RAW);
+		ndctl_namespace_delete(ndns);
+	}
+
+	return rc;
 }
 
 static int zero_info_block(struct ndctl_namespace *ndns)
-- 
1.8.3.1

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* RE: [External]  [ndctl PATCH] ndctl: recover from failed namespace creation
  2018-09-11  8:31 [ndctl PATCH] ndctl: recover from failed namespace creation oceanhehy
@ 2018-11-28  8:06 ` Ocean HY1 He
  2018-11-28 22:10 ` Dan Williams
  1 sibling, 0 replies; 3+ messages in thread
From: Ocean HY1 He @ 2018-11-28  8:06 UTC (permalink / raw)
  To: oceanhehy, dan.j.williams, vishal.l.verma, qi.fuli, linux-nvdimm

Hi Dan,

I am trying to track this patch and looking forward to get your comments.

Many thanks!

Ocean.

> -----Original Message-----
> From: oceanhehy@gmail.com <oceanhehy@gmail.com>
> Sent: Tuesday, September 11, 2018 4:31 PM
> To: dan.j.williams@intel.com; vishal.l.verma@intel.com; qi.fuli@jp.fujitsu.com;
> linux-nvdimm@lists.01.org
> Cc: Ocean HY1 He <hehy1@lenovo.com>
> Subject: [External] [ndctl PATCH] ndctl: recover from failed namespace
> creation
> 
> From: Ocean He <hehy1@lenovo.com>
> 
> When namespace creation failure occurs, the consumed namespace (seed or
> 0th
> idle) and pfn/dax seed would block next namespace creation. A recovery is
> needed to handle this type failure.
> 
> A symptom example (section size is 128MB) based on kernel 4.19-rc2 and
> ndctl v62:
> 	# ndctl create-namespace -r region1 -s 100m -t pmem -m fsdax
> 	{
> 	  "dev":"namespace1.0",
> 	  "mode":"fsdax",
> 	  "map":"dev",
> 	  "size":"96.00 MiB (100.66 MB)",
> 	  "uuid":"ef9a0556-a610-40b5-8c71-43991765a2cc",
> 	  "raw_uuid":"177b22e2-b7e8-482f-a063-2b8de876d979",
> 	  "sector_size":512,
> 	  "blockdev":"pmem1",
> 	  "numa_node":1
> 	}
> 	# ndctl create-namespace -r region1 -s 100m -t pmem -m fsdax
> 	libndctl: ndctl_pfn_enable: pfn1.1: failed to enable
> 	  Error: namespace1.1: failed to enable
> 	failed to create namespace: No such device or address
> 	# ndctl destroy-namespace namespace1.0 -f
> 	destroyed 1 namespace
> 	# ndctl create-namespace -r region1 -s 128m -t pmem -m fsdax
> 	failed to create namespace: Device or resource busy
> 
> Signed-off-by: Ocean He <hehy1@lenovo.com>
> ---
> Additional information:
> A kernel patch to fix this has been reviewed by Dan Williams, and he prefers
> to handle it in ndctl directly.
> https://www.spinics.net/lists/kernel/msg2901465.html
> 
>  ndctl/namespace.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/ndctl/namespace.c b/ndctl/namespace.c
> index 510553c..76ee2ed 100644
> --- a/ndctl/namespace.c
> +++ b/ndctl/namespace.c
> @@ -393,6 +393,8 @@ static int setup_namespace(struct ndctl_region
> *region,
>  			try(ndctl_pfn, set_align, pfn, p->align);
>  		try(ndctl_pfn, set_namespace, pfn, ndns);
>  		rc = ndctl_pfn_enable(pfn);
> +		if (rc)
> +			ndctl_pfn_set_namespace(pfn, NULL);
>  	} else if (p->mode == NDCTL_NS_MODE_DAX) {
>  		struct ndctl_dax *dax = ndctl_region_get_dax_seed(region);
> 
> @@ -402,6 +404,8 @@ static int setup_namespace(struct ndctl_region
> *region,
>  		try(ndctl_dax, set_align, dax, p->align);
>  		try(ndctl_dax, set_namespace, dax, ndns);
>  		rc = ndctl_dax_enable(dax);
> +		if (rc)
> +			ndctl_dax_set_namespace(dax, NULL);
>  	} else if (p->mode == NDCTL_NS_MODE_SAFE) {
>  		struct ndctl_btt *btt = ndctl_region_get_btt_seed(region);
> 
> @@ -783,7 +787,13 @@ static int namespace_create(struct ndctl_region
> *region)
>  		return -ENODEV;
>  	}
> 
> -	return setup_namespace(region, ndns, &p);
> +	rc = setup_namespace(region, ndns, &p);
> +	if (rc) {
> +		ndctl_namespace_set_enforce_mode(ndns,
> NDCTL_NS_MODE_RAW);
> +		ndctl_namespace_delete(ndns);
> +	}
> +
> +	return rc;
>  }
> 
>  static int zero_info_block(struct ndctl_namespace *ndns)
> --
> 1.8.3.1

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [ndctl PATCH] ndctl: recover from failed namespace creation
  2018-09-11  8:31 [ndctl PATCH] ndctl: recover from failed namespace creation oceanhehy
  2018-11-28  8:06 ` [External] " Ocean HY1 He
@ 2018-11-28 22:10 ` Dan Williams
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Williams @ 2018-11-28 22:10 UTC (permalink / raw)
  To: Ocean He; +Cc: Ocean HY1 He, linux-nvdimm

On Tue, Sep 11, 2018 at 1:34 AM <oceanhehy@gmail.com> wrote:
>
> From: Ocean He <hehy1@lenovo.com>
>
> When namespace creation failure occurs, the consumed namespace (seed or 0th
> idle) and pfn/dax seed would block next namespace creation. A recovery is
> needed to handle this type failure.
>
> A symptom example (section size is 128MB) based on kernel 4.19-rc2 and
> ndctl v62:
>         # ndctl create-namespace -r region1 -s 100m -t pmem -m fsdax
>         {
>           "dev":"namespace1.0",
>           "mode":"fsdax",
>           "map":"dev",
>           "size":"96.00 MiB (100.66 MB)",
>           "uuid":"ef9a0556-a610-40b5-8c71-43991765a2cc",
>           "raw_uuid":"177b22e2-b7e8-482f-a063-2b8de876d979",
>           "sector_size":512,
>           "blockdev":"pmem1",
>           "numa_node":1
>         }
>         # ndctl create-namespace -r region1 -s 100m -t pmem -m fsdax
>         libndctl: ndctl_pfn_enable: pfn1.1: failed to enable
>           Error: namespace1.1: failed to enable
>         failed to create namespace: No such device or address
>         # ndctl destroy-namespace namespace1.0 -f
>         destroyed 1 namespace
>         # ndctl create-namespace -r region1 -s 128m -t pmem -m fsdax
>         failed to create namespace: Device or resource busy
>
> Signed-off-by: Ocean He <hehy1@lenovo.com>

Apologies, this got lost in my inbox. Looks good, and tests ok as well.

Reviewed-by: Dan Williams <dan.j.williams@intel.com>
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

end of thread, other threads:[~2018-11-28 22:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-11  8:31 [ndctl PATCH] ndctl: recover from failed namespace creation oceanhehy
2018-11-28  8:06 ` [External] " Ocean HY1 He
2018-11-28 22:10 ` 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).