diff mbox series

[ndctl] zero_info_block: skip seed devices

Message ID x49r1lohpty.fsf@segfault.boston.devel.redhat.com (mailing list archive)
State Accepted
Commit fb13dfb8d84c4f0a749665c8f07179450b199f3e
Headers show
Series [ndctl] zero_info_block: skip seed devices | expand

Commit Message

Jeff Moyer Feb. 9, 2021, 9:51 p.m. UTC
Currently, ndctl destroy-namespace -f all will output errors of the

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

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


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

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


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