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 <[email protected]>
---
 ndctl/namespace.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 75ea366574f8..f215f77a94e1 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -1806,6 +1806,15 @@ static int do_xaction_namespace(const char *namespace,
        if (ri_ctx.f_out && ri_ctx.f_out != stdout)
                fclose(ri_ctx.f_out);
 
+       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;
 }
 

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to