]> sourceware.org Git - lvm2.git/commitdiff
lvconvert: writecache fix return code
authorZdenek Kabelac <zkabelac@redhat.com>
Fri, 21 Dec 2018 19:49:36 +0000 (20:49 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Fri, 21 Dec 2018 20:42:30 +0000 (21:42 +0100)
Detach function return 0 for error and 1 for success.
Add missing log errors from failing deactivation.
Add missing log error from failing synchronization.

tools/lvconvert.c

index f6f94c0fa44fb3dce1dd349627a46d38f236f7c5..17d74543403926412505963b11df775e6be2e1b8 100644 (file)
@@ -5165,7 +5165,7 @@ static int _lvconvert_detach_writecache(struct cmd_context *cmd,
        }
 
        if (!archive(lv->vg))
-               goto_bad;
+               return_0;
 
        /*
         * Activate LV internally since the LV needs to be active to flush.
@@ -5180,17 +5180,23 @@ static int _lvconvert_detach_writecache(struct cmd_context *cmd,
                return 0;
        }
 
-       sync_local_dev_names(cmd);
+       if (!sync_local_dev_names(cmd)) {
+               log_error("Failed to sync local devices before detaching LV %s.",
+                         display_lvname(lv));
+               return 0;
+       }
 
        if (!lv_writecache_message(lv, "flush")) {
                log_error("Failed to flush writecache for %s.", display_lvname(lv));
-               deactivate_lv(cmd, lv);
+               if (!deactivate_lv(cmd, lv))
+                       log_error("Failed to deactivate %s.", display_lvname(lv));
                return 0;
        }
 
        if (!_get_writecache_kernel_error(cmd, lv, &kernel_error)) {
                log_error("Failed to get writecache error status for %s.", display_lvname(lv));
-               deactivate_lv(cmd, lv);
+               if (!deactivate_lv(cmd, lv))
+                       log_error("Failed to deactivate %s.", display_lvname(lv));
                return 0;
        }
 
@@ -5219,10 +5225,7 @@ static int _lvconvert_detach_writecache(struct cmd_context *cmd,
 
        log_print_unless_silent("Logical volume %s write cache has been detached.",
                                display_lvname(lv));
-       return ECMD_PROCESSED;
-bad:
-       return ECMD_FAILED;
-
+       return 1;
 }
 
 static int _get_one_writecache_setting(struct cmd_context *cmd, struct writecache_settings *settings,
This page took 0.040567 seconds and 5 git commands to generate.