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

0670da
zero_info_block: skip seed devices
0670da
0670da
BZ: 
0670da
Brew: 
0670da
0670da
commit fb13dfb8d84c4f0a749665c8f07179450b199f3e
0670da
Author: Jeff Moyer <jmoyer@redhat.com>
0670da
Date:   Tue Feb 9 16:51:53 2021 -0500
0670da
0670da
    zero_info_block: skip seed devices
0670da
    
0670da
    Currently, ndctl destroy-namespace -f all will output errors of the
0670da
    form:
0670da
    
0670da
      Error: destroy namespace: namespace0.0 failed to enable for zeroing, continuing
0670da
    
0670da
    for any zero-sized namespace.  That particular namespace looks like this:
0670da
    
0670da
      {
0670da
        "dev":"namespace0.0",
0670da
        "mode":"raw",
0670da
        "size":0,
0670da
        "uuid":"00000000-0000-0000-0000-000000000000",
0670da
        "sector_size":512,
0670da
        "state":"disabled"
0670da
      }
0670da
    
0670da
    This patch skips over namespaces with size=0 when zeroing out info
0670da
    blocks.
0670da
    
0670da
    Fixes: 46654c2d60b70 ("ndctl/namespace: Always zero info-blocks")
0670da
    Reported-by: Zhang Yi <yizhan@redhat.com>
0670da
    Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
0670da
    Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
0670da
    Link: https://lore.kernel.org/r/x49r1lohpty.fsf@segfault.boston.devel.redhat.com
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) {