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

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