[ndctl,v4,7/7] ndctl/namespace: Report ENOSPC when regions are full
diff mbox series

Message ID 156504776008.847544.15426025945427673536.stgit@dwillia2-desk3.amr.corp.intel.com
State Superseded
Commit 93c91256ab136421a9f51dcc5a1462b2f0a26419
Headers show
Series
  • Improvements for namespace creation/interrogation
Related show

Commit Message

Dan Williams Aug. 5, 2019, 11:29 p.m. UTC
The create-namespace error message:

    failed to create namespace: Resource temporarily unavailable

...is misleading because the lack of capacity is permanent until the
user frees up space.

Trap EAGAIN and translate to ENOSPC in case the region capacity search
fails:

    failed to create namespace: No space left on device

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 ndctl/namespace.c |    9 +++++++++
 1 file changed, 9 insertions(+)

Patch
diff mbox series

diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 5c457224cb13..89113f760bbf 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -1415,6 +1415,15 @@  static int do_xaction_namespace(const char *namespace,
 		}
 	}
 
+	if (action == ACTION_CREATE && rc == -EAGAIN) {
+		/*
+		 * Namespace creation searched through all candidate
+		 * regions and all of them said "nope, I don't have
+		 * enough capacity", so report -ENOSPC
+		 */
+		rc = -ENOSPC;
+	}
+
 	return rc;
 }