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

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