When a DIMM is disabled due to a label parsing issue "ndctl init-labels"
mis-reports the status of the init-labels command:

    # ndctl init-labels all -f
    initialized 1 nmem
    [root@dwillia2-dev ndctl]# ndctl list -Di
    [
      {
        "dev":"nmem1",
        "id":"8680-57341200",
        "handle":2,
        "phys_id":0,
        "state":"disabled"
      },
      {
        "dev":"nmem0",
        "id":"8680-56341200",
        "handle":1,
        "phys_id":0
      }
    ]
    # ndctl init-labels nmem1 -f
    initialized 1020 nmems

Catch any positive return from action_init() as success:

    # ndctl init-labels all -f
    initialized 2 nmems
    # ndctl init-labels nmem1 -f
    initialized 1 nmem

Reported-by: Jane Chu <[email protected]>

Signed-off-by: Dan Williams <[email protected]>
---
 ndctl/dimm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ndctl/dimm.c b/ndctl/dimm.c
index c7ad621367e9..5e6fa19bab15 100644
--- a/ndctl/dimm.c
+++ b/ndctl/dimm.c
@@ -1035,7 +1035,7 @@ static int __action_init(struct ndctl_dimm *dimm,
 
  out:
        ndctl_cmd_unref(cmd_read);
-       return rc;
+       return rc >= 0 ? 0 : rc;
 }
 
 static int action_init(struct ndctl_dimm *dimm, struct action_context *actx)

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

Reply via email to