Blame SOURCES/0009-zero_info_block-skip-seed-devices.patch

e0018b
From fb13dfb8d84c4f0a749665c8f07179450b199f3e Mon Sep 17 00:00:00 2001
e0018b
From: Jeff Moyer <jmoyer@redhat.com>
e0018b
Date: Tue, 9 Feb 2021 16:51:53 -0500
e0018b
Subject: [PATCH 009/217] zero_info_block: skip seed devices
e0018b
e0018b
Currently, ndctl destroy-namespace -f all will output errors of the
e0018b
form:
e0018b
e0018b
  Error: destroy namespace: namespace0.0 failed to enable for zeroing, continuing
e0018b
e0018b
for any zero-sized namespace.  That particular namespace looks like this:
e0018b
e0018b
  {
e0018b
    "dev":"namespace0.0",
e0018b
    "mode":"raw",
e0018b
    "size":0,
e0018b
    "uuid":"00000000-0000-0000-0000-000000000000",
e0018b
    "sector_size":512,
e0018b
    "state":"disabled"
e0018b
  }
e0018b
e0018b
This patch skips over namespaces with size=0 when zeroing out info
e0018b
blocks.
e0018b
e0018b
Fixes: 46654c2d60b70 ("ndctl/namespace: Always zero info-blocks")
e0018b
Reported-by: Zhang Yi <yizhan@redhat.com>
e0018b
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
e0018b
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
e0018b
Link: https://lore.kernel.org/r/x49r1lohpty.fsf@segfault.boston.devel.redhat.com
e0018b
---
e0018b
 ndctl/namespace.c | 3 +++
e0018b
 1 file changed, 3 insertions(+)
e0018b
e0018b
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
e0018b
index 1feb74d..1e8a2cd 100644
e0018b
--- a/ndctl/namespace.c
e0018b
+++ b/ndctl/namespace.c
e0018b
@@ -1052,6 +1052,9 @@ static int zero_info_block(struct ndctl_namespace *ndns)
e0018b
 	void *buf = NULL, *read_buf = NULL;
e0018b
 	char path[50];
e0018b
 
e0018b
+	if (ndctl_namespace_get_size(ndns) == 0)
e0018b
+		return 1;
e0018b
+
e0018b
 	ndctl_namespace_set_raw_mode(ndns, 1);
e0018b
 	rc = ndctl_namespace_enable(ndns);
e0018b
 	if (rc < 0) {
e0018b
-- 
e0018b
2.27.0
e0018b