All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vishal Verma <vishal.l.verma@intel.com>
To: linux-nvdimm@lists.01.org
Cc: Ami Pathak <ami.g.pathak@intel.com>
Subject: [ndctl PATCH v2 2/4] ndctl, inject-smart: switch to ndctl_cmd_submit_xlat
Date: Fri, 11 Jan 2019 18:30:33 -0700	[thread overview]
Message-ID: <20190112013035.32087-3-vishal.l.verma@intel.com> (raw)
In-Reply-To: <20190112013035.32087-1-vishal.l.verma@intel.com>

The ndctl inject-smart command was neglecting to check the
'firmware_status' field that is set by the platform firmware to indicate
failure. Use the new ndctl_cmd_submit_xlat facility to include the
firmware_status check as part of the command submission.

Reported-by: Ami Pathak <ami.g.pathak@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 ndctl/inject-smart.c    | 16 ++++++++--------
 ndctl/util/json-smart.c |  8 ++++----
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/ndctl/inject-smart.c b/ndctl/inject-smart.c
index eaa137a..00c81b8 100644
--- a/ndctl/inject-smart.c
+++ b/ndctl/inject-smart.c
@@ -280,8 +280,8 @@ static int smart_set_thresh(struct ndctl_dimm *dimm)
 		goto out;
 	}
 
-	rc = ndctl_cmd_submit(st_cmd);
-	if (rc) {
+	rc = ndctl_cmd_submit_xlat(st_cmd);
+	if (rc < 0) {
 		error("%s: smart threshold command failed: %s (%d)\n",
 			name, strerror(abs(rc)), rc);
 		goto out;
@@ -320,8 +320,8 @@ static int smart_set_thresh(struct ndctl_dimm *dimm)
 		ndctl_cmd_smart_threshold_set_alarm_control(sst_cmd, alarm);
 	}
 
-	rc = ndctl_cmd_submit(sst_cmd);
-	if (rc)
+	rc = ndctl_cmd_submit_xlat(sst_cmd);
+	if (rc < 0)
 		error("%s: smart set threshold command failed: %s (%d)\n",
 			name, strerror(abs(rc)), rc);
 
@@ -351,8 +351,8 @@ out:
 			if (sctx.err_continue == false) \
 				goto out; \
 		} \
-		rc = ndctl_cmd_submit(si_cmd); \
-		if (rc) { \
+		rc = ndctl_cmd_submit_xlat(si_cmd); \
+		if (rc < 0) { \
 			error("%s: smart inject %s command failed: %s (%d)\n", \
 				name, #arg, strerror(abs(rc)), rc); \
 			if (sctx.err_continue == false) \
@@ -382,8 +382,8 @@ out:
 			if (sctx.err_continue == false) \
 				goto out; \
 		} \
-		rc = ndctl_cmd_submit(si_cmd); \
-		if (rc) { \
+		rc = ndctl_cmd_submit_xlat(si_cmd); \
+		if (rc < 0) { \
 			error("%s: smart inject %s command failed: %s (%d)\n", \
 				name, #arg, strerror(abs(rc)), rc); \
 			if (sctx.err_continue == false) \
diff --git a/ndctl/util/json-smart.c b/ndctl/util/json-smart.c
index 3c1b917..92a9313 100644
--- a/ndctl/util/json-smart.c
+++ b/ndctl/util/json-smart.c
@@ -30,8 +30,8 @@ static void smart_threshold_to_json(struct ndctl_dimm *dimm,
 	if (!cmd)
 		return;
 
-	rc = ndctl_cmd_submit(cmd);
-	if (rc || ndctl_cmd_get_firmware_status(cmd))
+	rc = ndctl_cmd_submit_xlat(cmd);
+	if ((rc < 0) || ndctl_cmd_get_firmware_status(cmd))
 		goto out;
 
 	alarm_control = ndctl_cmd_smart_threshold_get_alarm_control(cmd);
@@ -115,8 +115,8 @@ struct json_object *util_dimm_health_to_json(struct ndctl_dimm *dimm)
 	if (!cmd)
 		goto err;
 
-	rc = ndctl_cmd_submit(cmd);
-	if (rc || ndctl_cmd_get_firmware_status(cmd)) {
+	rc = ndctl_cmd_submit_xlat(cmd);
+	if ((rc < 0) || ndctl_cmd_get_firmware_status(cmd)) {
 		jobj = json_object_new_string("unknown");
 		if (jobj)
 			json_object_object_add(jhealth, "health_state", jobj);
-- 
2.17.2

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  parent reply	other threads:[~2019-01-12  1:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-12  1:30 [ndctl PATCH v2 0/4] Add missing firmware_status checks Vishal Verma
2019-01-12  1:30 ` [ndctl PATCH v2 1/4] libndctl, intel: Add infrastructure for firmware_status translation Vishal Verma
2019-01-12  1:53   ` Dan Williams
2019-01-12  1:30 ` Vishal Verma [this message]
2019-01-12  1:58   ` [ndctl PATCH v2 2/4] ndctl, inject-smart: switch to ndctl_cmd_submit_xlat Dan Williams
2019-01-12  2:03     ` Verma, Vishal L
2019-01-12  2:05       ` Dan Williams
2019-01-12  1:30 ` [ndctl PATCH v2 3/4] ndctl, monitor: " Vishal Verma
2019-01-12  1:54   ` Dan Williams
2019-01-12  1:30 ` [ndctl PATCH v2 4/4] ndctl: clean up usage of ndctl_cmd_submit Vishal Verma
2019-01-12  1:53   ` Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190112013035.32087-3-vishal.l.verma@intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=ami.g.pathak@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.