]> sourceware.org Git - lvm2.git/commitdiff
vgchange: start polling with activation
authorZdenek Kabelac <zkabelac@redhat.com>
Thu, 14 Jun 2018 19:05:41 +0000 (21:05 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Thu, 14 Jun 2018 20:02:01 +0000 (22:02 +0200)
Shuffle code for better readability as set of conditions was
hard to follow.

Make it obvious the refresh & activate path is handling
monitoring and polling on its own.

So the only --monitor and --poll option needs explicit care.
Option --monitor without option --poll will now as a result
of this patch NOT start polling.

So command: vgchange --monitor n    is no longer a polling starter.

tools/vgchange.c

index c5134706da369522b911522180aec794a2207171..c444c30264d49af1679193d1e996b05d9af9d792 100644 (file)
@@ -662,26 +662,21 @@ static int _vgchange_single(struct cmd_context *cmd, const char *vg_name,
                activate = (activation_change_t) arg_uint_value(cmd, activate_ARG, 0);
                if (!vgchange_activate(cmd, vg, activate))
                        return_ECMD_FAILED;
-       }
-
-       if (arg_is_set(cmd, refresh_ARG)) {
+       } else if (arg_is_set(cmd, refresh_ARG)) {
                /* refreshes the visible LVs (which starts polling) */
                if (!_vgchange_refresh(cmd, vg))
                        return_ECMD_FAILED;
-       }
-
-       if (!arg_is_set(cmd, activate_ARG) &&
-           !arg_is_set(cmd, refresh_ARG) &&
-           arg_is_set(cmd, monitor_ARG)) {
+       } else {
                /* -ay* will have already done monitoring changes */
-               if (!_vgchange_monitoring(cmd, vg))
+               if (arg_is_set(cmd, monitor_ARG) &&
+                   !_vgchange_monitoring(cmd, vg))
                        return_ECMD_FAILED;
-       }
 
-       if (!arg_is_set(cmd, refresh_ARG) &&
-           arg_is_set(cmd, poll_ARG) &&
-           !vgchange_background_polling(cmd, vg))
-               return_ECMD_FAILED;
+               /* When explicitelly specified --poll */
+               if (arg_is_set(cmd, poll_ARG) &&
+                   !vgchange_background_polling(cmd, vg))
+                       return_ECMD_FAILED;
+       }
 
        return ret;
 }
This page took 0.038875 seconds and 5 git commands to generate.