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

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