Skip to contentSkip to conversation

zero_info_block: skip seed devices

PATCH New Jeff Moyer 1 participant 1 message Feb 9, 2021 libnvdimm: non-volatile memory device

lore
Share & tools
lore

Jeff Moyer

author
#0 lore raw

PATCH 1/1 zero_info_block: skip seed devices

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")
ndctl/namespace.c +3 -0
index 0c8df9f..de1e08f 100644
@@ -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 -- [email protected] To unsubscribe send an email to [email protected]