nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Vishal Verma <vishal.l.verma@intel.com>
To: linux-nvdimm@lists.01.org
Subject: [ndctl PATCH] ndctl, inject-smart: continue in spite of errors for uninject-all
Date: Fri,  3 Aug 2018 11:27:11 -0600	[thread overview]
Message-ID: <20180803172712.3219-1-vishal.l.verma@intel.com> (raw)

When the missing command submissions for ctrl-temperature were added to
inject-smart, as a side effect, uninject-all also started trying to
uninject ctrl-temperature. Since DSMs for smart injection for certain
platforms don't support ctrl-temperature injection, this failed the
command.

For the uninject-all command, add a sctx flag that allows command
submissions to continue in spite of errors. The error messages are still
printed out, so they are not lost. This way, uninject-all does a
best-effort uninjection of all fields, even if some fields are
unsupported by the given platform.

Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 ndctl/inject-smart.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/ndctl/inject-smart.c b/ndctl/inject-smart.c
index 56c39ab..d60bbf1 100644
--- a/ndctl/inject-smart.c
+++ b/ndctl/inject-smart.c
@@ -54,6 +54,7 @@ static struct parameters {
 
 static struct smart_ctx {
 	bool alarms_present;
+	bool err_continue;
 	unsigned long op_mask;
 	unsigned long flags;
 	unsigned int media_temperature;
@@ -220,6 +221,7 @@ static int smart_init(void)
 {
 	if (param.human)
 		sctx.flags |= UTIL_JSON_HUMAN;
+	sctx.err_continue = false;
 
 	/* setup attributes and thresholds except alarm_control */
 	smart_param_setup_temps(media_temperature)
@@ -244,6 +246,7 @@ static int smart_init(void)
 		param.spares_uninject = true;
 		param.fatal_uninject = true;
 		param.unsafe_shutdown_uninject = true;
+		sctx.err_continue = true;
 	}
 	smart_param_setup_uninj(media_temperature)
 	smart_param_setup_uninj(ctrl_temperature)
@@ -337,7 +340,8 @@ out:
 		si_cmd = ndctl_dimm_cmd_new_smart_inject(dimm); \
 		if (!si_cmd) { \
 			error("%s: no smart inject command support\n", name); \
-			goto out; \
+			if (sctx.err_continue == false) \
+				goto out; \
 		} \
 		if (param.arg##_uninject) \
 			enable = false; \
@@ -345,13 +349,15 @@ out:
 		if (rc) { \
 			error("%s: smart inject %s cmd invalid: %s (%d)\n", \
 				name, #arg, strerror(abs(rc)), rc); \
-			goto out; \
+			if (sctx.err_continue == false) \
+				goto out; \
 		} \
 		rc = ndctl_cmd_submit(si_cmd); \
 		if (rc) { \
 			error("%s: smart inject %s command failed: %s (%d)\n", \
 				name, #arg, strerror(abs(rc)), rc); \
-			goto out; \
+			if (sctx.err_continue == false) \
+				goto out; \
 		} \
 		ndctl_cmd_unref(si_cmd); \
 	} \
@@ -365,7 +371,8 @@ out:
 		si_cmd = ndctl_dimm_cmd_new_smart_inject(dimm); \
 		if (!si_cmd) { \
 			error("%s: no smart inject command support\n", name); \
-			goto out; \
+			if (sctx.err_continue == false) \
+				goto out; \
 		} \
 		if (param.arg##_uninject) \
 			enable = false; \
@@ -373,13 +380,15 @@ out:
 		if (rc) { \
 			error("%s: smart inject %s cmd invalid: %s (%d)\n", \
 				name, #arg, strerror(abs(rc)), rc); \
-			goto out; \
+			if (sctx.err_continue == false) \
+				goto out; \
 		} \
 		rc = ndctl_cmd_submit(si_cmd); \
 		if (rc) { \
 			error("%s: smart inject %s command failed: %s (%d)\n", \
 				name, #arg, strerror(abs(rc)), rc); \
-			goto out; \
+			if (sctx.err_continue == false) \
+				goto out; \
 		} \
 		ndctl_cmd_unref(si_cmd); \
 	} \
-- 
2.14.4

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

                 reply	other threads:[~2018-08-03 17:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180803172712.3219-1-vishal.l.verma@intel.com \
    --to=vishal.l.verma@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).