linux-nvdimm.lists.01.org 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, ars: don't invalidate the user-provided command
Date: Fri,  1 Jun 2018 17:28:14 -0600	[thread overview]
Message-ID: <20180601232814.27865-1-vishal.l.verma@intel.com> (raw)

In ndctl_cmd_ars_in_progress, which expects a successfully completed
ars_status command, we used to invalidate the command by setting its
status to '1', so that the user has to provide a fresh ars_status
command the next time this check is performed.

In hindsight, this is needless and violates the principle of least
surprise. We shouldn't be touching the user's data (command), so remove
this invalidation. If the user uses the same ars_status command again,
we will simply report that ARS is still in progress.

Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 ndctl/lib/ars.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/ndctl/lib/ars.c b/ndctl/lib/ars.c
index b199646..48a9819 100644
--- a/ndctl/lib/ars.c
+++ b/ndctl/lib/ars.c
@@ -224,16 +224,7 @@ NDCTL_EXPORT int ndctl_cmd_ars_in_progress(struct ndctl_cmd *cmd)
 	if (!validate_ars_stat(ctx, cmd))
 		return 0;
 
-	if (ndctl_cmd_get_firmware_status(cmd) == 1 << 16) {
-		/*
-		 * If in-progress, invalidate the ndctl_cmd, so
-		 * that if we're called again without a fresh
-		 * ars_status command, we fail.
-		 */
-		cmd->status = 1;
-		return 1;
-	}
-	return 0;
+	return (ndctl_cmd_get_firmware_status(cmd) == 1 << 16);
 }
 
 NDCTL_EXPORT unsigned int ndctl_cmd_ars_num_records(struct ndctl_cmd *ars_stat)
-- 
2.17.0

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

             reply	other threads:[~2018-06-01 23:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01 23:28 Vishal Verma [this message]
2018-06-02  0:05 ` [ndctl PATCH] ndctl, ars: don't invalidate the user-provided command 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=20180601232814.27865-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).