linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
* [ndctl patch] zero_info_block: skip seed devices
@ 2021-02-09 21:51 Jeff Moyer
  0 siblings, 0 replies; only message in thread
From: Jeff Moyer @ 2021-02-09 21:51 UTC (permalink / raw)
  To: Vishal Verma; +Cc: linux-nvdimm

Currently, ndctl destroy-namespace -f all will output errors of the
form:

  Error: destroy namespace: namespace0.0 failed to enable for zeroing, continuing

for any zero-sized namespace.  That particular namespace looks like this:

  {
    "dev":"namespace0.0",
    "mode":"raw",
    "size":0,
    "uuid":"00000000-0000-0000-0000-000000000000",
    "sector_size":512,
    "state":"disabled"
  }

This patch skips over namespaces with size=0 when zeroing out info
blocks.

Fixes: 46654c2d60b70 ("ndctl/namespace: Always zero info-blocks")
Reported-by: Zhang Yi <yizhan@redhat.com>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>

diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 0c8df9f..de1e08f 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -1052,6 +1052,9 @@ static int zero_info_block(struct ndctl_namespace *ndns)
 	void *buf = NULL, *read_buf = NULL;
 	char path[50];
 
+	if (ndctl_namespace_get_size(ndns) == 0)
+		return 1;
+
 	ndctl_namespace_set_raw_mode(ndns, 1);
 	rc = ndctl_namespace_enable(ndns);
 	if (rc < 0) {
_______________________________________________
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] only message in thread

only message in thread, other threads:[~2021-02-09 21:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-09 21:51 [ndctl patch] zero_info_block: skip seed devices Jeff Moyer

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).