All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Johnston <johnstonj.public@codenest.com>
To: lvm-devel@redhat.com
Subject: [PATCH] RAID: fix incorrect exit status from lvchange --syncaction
Date: Sat, 2 Apr 2016 04:20:13 -0000	[thread overview]
Message-ID: <009201d18c96$f56c3ef0$e044bcd0$@codenest.com> (raw)

Hi,

This patch fixes a bug where lvchange --syncaction returns a successful exit
status even when it actually failed.

Test case:

$ lvchange --syncaction repair VG/DataCache
$ lvchange --syncaction repair VG/DataCache
  VG/DataCache is currently "repair".  Unable to switch to "repair".
$ echo $?
0

Since it gave an error, I'd expect the exit status to be non-zero.

>From 2f12e1f2aa933dca100a9dc505c1a6adfb7b99fd Mon Sep 17 00:00:00 2001
From: James Johnston <johnstonj.public@codenest.com>
Date: Sat, 2 Apr 2016 04:04:59 +0000
Subject: [PATCH] RAID: fix incorrect exit status from lvchange --syncaction

Some of the possible errors from lvchange don't return a non-zero
exit status: for example, if a repair is already in progress.

This is because lv_raid_message erroneously sets the return value to
success prematurely, and it's not subsequently reset to a failing
value.

Signed-off-by: James Johnston <johnstonj.public@codenest.com>
---
 lib/activate/activate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index a3b2379..1713b8c 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1013,7 +1013,7 @@ int lv_raid_message(const struct logical_volume *lv, const char *msg)
 	if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
 		return_0;
 
-	if (!(r = dev_manager_raid_status(dm, lv, &status))) {
+	if (!dev_manager_raid_status(dm, lv, &status)) {
 		log_error("Failed to retrieve status of %s.",
 			  display_lvname(lv));
 		goto out;
-- 
1.9.5.msysgit.1




                 reply	other threads:[~2016-04-02  4:20 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='009201d18c96$f56c3ef0$e044bcd0$@codenest.com' \
    --to=johnstonj.public@codenest.com \
    --cc=lvm-devel@redhat.com \
    /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.