Blame SOURCES/80e0d88-namespace-action-Drop-zero-namespace-checks.patch

f9a104
namespace-action: Drop zero namespace checks.
f9a104
f9a104
BZ: 
f9a104
Brew: 
f9a104
f9a104
commit 80e0d88c3098bd419e26146a8cb3b693fdd06417
f9a104
Author: Santosh Sivaraj <santosh@fossix.org>
f9a104
Date:   Wed Jan 6 14:17:42 2021 +0100
f9a104
f9a104
    namespace-action: Drop zero namespace checks.
f9a104
    
f9a104
    With seed namespaces catched early on these checks for sizes in enable
f9a104
    and destroy namespace code path are not needed.
f9a104
    
f9a104
    Reverts commit b9cb03f6d5a8 ("ndctl/namespace: Fix enable-namespace
f9a104
    error for seed namespaces")
f9a104
    
f9a104
    Reverts commit e01045e58ad5 ("ndctl/namespace: Fix destroy-namespace
f9a104
    accounting relative to seed devices")
f9a104
    
f9a104
    Link: https://patchwork.kernel.org/patch/11739975/
f9a104
    Link: https://lore.kernel.org/r/eb4bc7885708fa13e3d37286bc4a4219b1e4e5b6.1609938610.git.msuchanek@suse.de
f9a104
    Fixes: b9cb03f6d5a8 ("ndctl/namespace: Fix enable-namespace error for seed namespaces")
f9a104
    Fixes: e01045e58ad5 ("ndctl/namespace: Fix destroy-namespace accounting relative to seed devices")
f9a104
    Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
f9a104
    [rebased on top of the previous patches]
f9a104
    Signed-off-by: Michal Suchanek <msuchanek@suse.de>
f9a104
    Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
f9a104
f9a104
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
f9a104
index 536e142..87f60b9 100644
f9a104
--- a/ndctl/lib/libndctl.c
f9a104
+++ b/ndctl/lib/libndctl.c
f9a104
@@ -4531,16 +4531,11 @@ NDCTL_EXPORT int ndctl_namespace_enable(struct ndctl_namespace *ndns)
f9a104
 	const char *devname = ndctl_namespace_get_devname(ndns);
f9a104
 	struct ndctl_ctx *ctx = ndctl_namespace_get_ctx(ndns);
f9a104
 	struct ndctl_region *region = ndns->region;
f9a104
-	unsigned long long size = ndctl_namespace_get_size(ndns);
f9a104
 	int rc;
f9a104
 
f9a104
 	if (ndctl_namespace_is_enabled(ndns))
f9a104
 		return 0;
f9a104
 
f9a104
-	/* Don't try to enable idle namespace (no capacity allocated) */
f9a104
-	if (size == 0)
f9a104
-		return -ENXIO;
f9a104
-
f9a104
 	rc = ndctl_bind(ctx, ndns->module, devname);
f9a104
 
f9a104
 	/*
f9a104
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
f9a104
index cd822b3..c67c086 100644
f9a104
--- a/ndctl/namespace.c
f9a104
+++ b/ndctl/namespace.c
f9a104
@@ -1164,15 +1164,12 @@ static int namespace_destroy(struct ndctl_region *region,
f9a104
 		struct ndctl_namespace *ndns)
f9a104
 {
f9a104
 	const char *devname = ndctl_namespace_get_devname(ndns);
f9a104
-	unsigned long long size;
f9a104
 	int rc;
f9a104
 
f9a104
 	rc = namespace_prep_reconfig(region, ndns);
f9a104
 	if (rc < 0)
f9a104
 		return rc;
f9a104
 
f9a104
-	size = ndctl_namespace_get_size(ndns);
f9a104
-
f9a104
 	/* Labeled namespace, destroy label / allocation */
f9a104
 	if (rc == 2) {
f9a104
 		rc = ndctl_namespace_delete(ndns);
f9a104
@@ -1180,13 +1177,6 @@ static int namespace_destroy(struct ndctl_region *region,
f9a104
 			debug("%s: failed to reclaim\n", devname);
f9a104
 	}
f9a104
 
f9a104
-	/*
f9a104
-	 * Don't report a destroyed namespace when no capacity was
f9a104
-	 * allocated.
f9a104
-	 */
f9a104
-	if (size == 0 && rc == 0)
f9a104
-		rc = 1;
f9a104
-
f9a104
 	return rc;
f9a104
 }
f9a104