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

Message ID 156505018281.848599.6510034459473826921.stgit@dwillia2-desk3.amr.corp.intel.com
State Accepted
Commit 42008030b6d6683dbe7f5b69a3c54f1374cced8a
Headers show
Series
  • Improvements for namespace creation/interrogation
Related show

Commit Message

Dan Williams Aug. 6, 2019, 12:09 a.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;
 }