Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2e04681248b7c72c…
Commit: 2e04681248b7c72ce295f538d698ae644c73cc9c
Parent: 290ae4791ef5eedaae2bc1cfa3645ac8073faf54
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Wed Sep 19 11:09:32 2012 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Wed Sep 19 11:16:45 2012 -0500
mirror: 'lvconvert --resync' should reset LV_NOTSYNCED on corelog mirror
When reformatting the 'lvchange_resync' code in commit
05131f5853e86419d9c726faa961b8d012298d9c, a '!' should have been removed
from the condition that checks for the LV_NOTSYNCED flag on a corelog
mirror LV. The presence of this '!' caused the LV_NOTSYNCED flag to be
cleared when it wasn't present and left when it was present.
It is not allowed to add images to a 'mirror' or 'raid1' LV if the
LV_NOTSYNCED flag is set. We add some up-convert tests to ensure this
behavior is being enforced and that the LV_NOTSYNCED flag is being
properly cleared by 'lvchange --resync'.
(Not updating WHATS_NEW because this is intrarelease.)
---
test/shell/lvconvert-mirror.sh | 14 ++++++++++++++
test/shell/lvconvert-raid.sh | 12 ++++++++++++
tools/lvchange.c | 2 +-
3 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvconvert-mirror.sh b/test/shell/lvconvert-mirror.sh
index 4d587d9..c09b8fd 100644
--- a/test/shell/lvconvert-mirror.sh
+++ b/test/shell/lvconvert-mirror.sh
@@ -264,3 +264,17 @@ lvremove -ff $vg/$lv1
lvcreate -l15 -n $lv1 $vg
not lvconvert -m1 --corelog --stripes 2 $vg/$lv1
lvremove -ff $vg
+
+# Should not be able to add images to --nosync mirror
+# but should be able to after 'lvchange --resync'
+lvcreate -m 1 -l1 -n $lv1 $vg --nosync
+not lvconvert -m +1 $vg/$lv1
+lvchange --resync -y $vg/$lv1
+lvconvert -m +1 $vg/$lv1
+lvremove -ff $vg
+
+lvcreate -m 1 --corelog -l1 -n $lv1 $vg --nosync
+not lvconvert -m +1 $vg/$lv1
+lvchange --resync -y $vg/$lv1
+lvconvert -m +1 $vg/$lv1
+lvremove -ff $vg
diff --git a/test/shell/lvconvert-raid.sh b/test/shell/lvconvert-raid.sh
index c62aee5..9c3cff6 100644
--- a/test/shell/lvconvert-raid.sh
+++ b/test/shell/lvconvert-raid.sh
@@ -79,6 +79,18 @@ for i in 1 2 3 4; do
done
done
+##############################################
+# RAID1 - shouldn't be able to add image
+# if created '--nosync', but should
+# be able to after 'lvchange --resync'
+##############################################
+lvcreate --type raid1 -m 1 -l 2 -n $lv1 $vg --nosync
+not lvconvert -m +1 $vg/$lv1
+lvchange --resync -y $vg/$lv1
+aux wait_for_sync $vg $lv1
+lvconvert -m +1 $vg/$lv1
+lvremove -ff $vg
+
# 3-way to 2-way convert while specifying devices
lvcreate --type raid1 -m 2 -l 2 -n $lv1 $vg $dev1 $dev2 $dev3
aux wait_for_sync $vg $lv1
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 0904e7b..5048cab 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -401,7 +401,7 @@ static int lvchange_resync(struct cmd_context *cmd,
* worry about persistent logs.
*/
if (!seg_is_raid(seg) && !seg->log_lv) {
- if (!(lv->status & LV_NOTSYNCED)) {
+ if (lv->status & LV_NOTSYNCED) {
lv->status &= ~LV_NOTSYNCED;
log_very_verbose("Updating logical volume \"%s\""
" on disk(s)", lv->name);
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2a6712ddefb6720d…
Commit: 2a6712ddefb6720d115d11c276223b57abf5dd94
Parent: 116bcb3ea4c3e4b030180757fb5be149af1fda07
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Fri Sep 14 16:26:53 2012 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Fri Sep 14 16:26:53 2012 -0500
RAID1: Clear the LV_NOTSYNCED flag when a RAID1 LV is converted to linear
Failing to clear the LV_NOTSYNCED flag when converting a RAID1 LV to
linear can result in the flag being present after an upconvert - even
if the sync is performed when upconverting.
---
WHATS_NEW | 1 +
lib/metadata/raid_manip.c | 10 +++++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 6ef9d5c..f2aa7ec 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.98 -
=================================
+ Clear LV_NOSYNCED flag when a RAID1 LV is converted to a linear LV.
Disallow RAID1 upconvert if the LV was created with --nosync.
Depend on systemd-udev-settle in units generated by activation generator.
Fix vgchange -aay to activate proper logical volumes.
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 131f9d2..0266013 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -1022,9 +1022,13 @@ static int _raid_remove_images(struct logical_volume *lv,
}
/* Convert to linear? */
- if ((new_count == 1) && !_raid_remove_top_layer(lv, &removal_list)) {
- log_error("Failed to remove RAID layer after linear conversion");
- return 0;
+ if (new_count == 1) {
+ if (!_raid_remove_top_layer(lv, &removal_list)) {
+ log_error("Failed to remove RAID layer"
+ " after linear conversion");
+ return 0;
+ }
+ lv->status &= ~LV_NOTSYNCED;
}
if (!vg_write(lv->vg)) {
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=116bcb3ea4c3e4b0…
Commit: 116bcb3ea4c3e4b030180757fb5be149af1fda07
Parent: 5cdd7848f46305d3d5744c194d4e2d38b78f0ec7
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Fri Sep 14 16:12:52 2012 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Fri Sep 14 16:12:52 2012 -0500
RAID1: Like mirrors, do not allow adding images to LV created w/ --nosync
Mirrors do not allow upconverting if the LV has been created with --nosync.
We will enforce the same rule for RAID1. It isn't hugely critical, since
the portions that have been written will be copied over to the new device
identically from either of the existing images. However, the unwritten
sections may be different, causing the added image to be a hybrid of the
existing images.
Also, we are disallowing the addition of new images to a RAID1 LV that has
not completed the initial sync. This may be different from mirroring, but
that is due to the fact that the 'mirror' segment type "stacks" when adding
a new image and RAID1 does not. RAID1 will rebuild a newly added image
"inline" from the existant images, so they should be in-sync.
---
WHATS_NEW | 1 +
lib/metadata/raid_manip.c | 12 ++++++++++++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2b897e8..6ef9d5c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.98 -
=================================
+ Disallow RAID1 upconvert if the LV was created with --nosync.
Depend on systemd-udev-settle in units generated by activation generator.
Fix vgchange -aay to activate proper logical volumes.
Properly handle 'resync' of RAID LVs.
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 4eced6f..131f9d2 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -639,6 +639,18 @@ static int _raid_add_images(struct logical_volume *lv,
struct lv_list *lvl;
struct lv_segment_area *new_areas;
+ if (lv->status & LV_NOTSYNCED) {
+ log_error("Can't add image to out-of-sync RAID LV:"
+ " use 'lvchange --resync' first.");
+ return 0;
+ }
+
+ if (!_raid_in_sync(lv)) {
+ log_error("Can't add image to RAID LV that"
+ " is still initializing.");
+ return 0;
+ }
+
dm_list_init(&meta_lvs); /* For image addition */
dm_list_init(&data_lvs); /* For image addition */