]> sourceware.org Git - lvm2.git/commitdiff
mirror: fix flushing for mirror target
authorZdenek Kabelac <zkabelac@redhat.com>
Tue, 5 Apr 2016 19:34:42 +0000 (21:34 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Wed, 6 Apr 2016 09:31:02 +0000 (11:31 +0200)
Fix regression caused by commit ba41ee1dc94264f7ac8e61f8b1d56b10225b0d2f.
The idea was to use no_flush for changed device only for thin volumes
and thin pools but also to merge this with change made in commit
844b00958492224c448b30f89ae5532bb6591fd2.

However the resulting condition has caused misbehavior for the mirror
suspend - as that has been before the ONLY allowed target type
that could have been suspended with noflush.

Result was badly working repair for --type mirror that has been
passing 'flush' to the repaired mirror target whenever preload
wrongly set flush_required.

The origin code has required the flush_required to be set whenever
deivce size is changed.

Now it first detects if device size got smaller
'dm_tree_node_size_changed(root) < 0' - this requires flush.
Otherwise it checks device is not thin volume nor thin pool and its
size has changed (got bigger) and requires flush.

This mean upsize of thin-pool or thin volume will not require flush.

lib/activate/dev_manager.c

index 3563d5a39c91597f17f7d578620b5687c432f491..22331c3b75de70555cbfbc43faecac7761b104f8 100644 (file)
@@ -3044,12 +3044,11 @@ static int _tree_action(struct dev_manager *dm, const struct logical_volume *lv,
 
                if ((dm_tree_node_size_changed(root) < 0))
                        dm->flush_required = 1;
-
                /* Currently keep the code require flush for any
-                * non 'thin pool/volume, mirror' or with any size change */
-               if (!lv_is_thin_volume(lv) &&
-                   !lv_is_thin_pool(lv) &&
-                   (!lv_is_mirror(lv) || dm_tree_node_size_changed(root)))
+                * non 'thin pool/volume' and  size increase */
+               else if (!lv_is_thin_volume(lv) &&
+                        !lv_is_thin_pool(lv) &&
+                        dm_tree_node_size_changed(root))
                        dm->flush_required = 1;
 
                if (action == ACTIVATE) {
This page took 0.046079 seconds and 5 git commands to generate.