RAID: fix incorrect exit status from lvchange --syncaction
PATCH 1/1 RAID: fix incorrect exit status from lvchange --syncaction
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.
Quoted 1 line
From
2f12e1f2aa933dca100a9dc505c1a6adfb7b99fdMon Sep 17 00:00:00 2001
From: James Johnston <[email protected]>
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 <[email protected]>
--- lib/activate/activate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/activate/activate.c +1 -1
@@ -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;
Signature · 1 line
1.9.5.msysgit.1