Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1b607890203911a0…
Commit: 1b607890203911a0f92e8f5d5f55e60b52d746ad
Parent: 5555d2a000ed4e3d5a694896f3dc6a7290543f43
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Tue Jul 24 22:28:23 2012 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Tue Jul 24 22:28:23 2012 -0500
Forgot to update WHATS_NEW for commit 5555d2a000ed4e3d5a694896f3dc6a7290543f43
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index aa26622..bca890e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.97 -
===============================
+ Fix segfault when attempting to replace RAID 4/5/6 device (2.02.97).
Fix dumpconfig <node> to print only <node> without its siblings (2.02.89).
Do not issue "Failed to handle a client connection" error if lvmetad killed.
Support changing of discard and zeroing for thin pool.
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5555d2a000ed4e3d…
Commit: 5555d2a000ed4e3d5a694896f3dc6a7290543f43
Parent: 407198e17dc805dd9ce0583c8b1dbade71572af6
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Tue Jul 24 19:02:06 2012 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Tue Jul 24 19:02:06 2012 -0500
RAID: Fix segfault when attempting to replace RAID 4/5/6 device
Commit 8767435ef847831455fadc1f7e8f4d2d94aef0d5 allowed RAID 4/5/6
LV to be extended properly, but introduced a regression in device
replacement - a critical component of fault tolerance.
When only 1 or 2 drives are being replaced, the 'area_count' needed
can be equal to the parity_count. The 'area_multiple' for RAID 4/5/6
was computed as 'area_count - parity_devs', which could result in
'area_multiple' being 0. This would ultimately lead to a division by
zero error. Therefore, in calc_area_multiple, it is important to take
into account the number of areas that are being requested - just as
we already do in _alloc_init.
---
lib/metadata/lv_manip.c | 11 ++++++++++-
test/shell/lvconvert-repair.sh | 26 +++++++++++++++++++++++++-
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 0d89b4a..daa90da 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -698,8 +698,17 @@ static uint32_t _calc_area_multiple(const struct segment_type *segtype,
return area_count;
/* Parity RAID (e.g. RAID 4/5/6) */
- if (segtype_is_raid(segtype) && segtype->parity_devs)
+ if (segtype_is_raid(segtype) && segtype->parity_devs) {
+ /*
+ * As articulated in _alloc_init, we can tell by
+ * the area_count whether a replacement drive is
+ * being allocated; and if this is the case, then
+ * there is no area_multiple that should be used.
+ */
+ if (area_count <= segtype->parity_devs)
+ return 1;
return area_count - segtype->parity_devs;
+ }
/* Mirrored stripes */
if (stripes)
diff --git a/test/shell/lvconvert-repair.sh b/test/shell/lvconvert-repair.sh
index 947998c..0aeeffa 100644
--- a/test/shell/lvconvert-repair.sh
+++ b/test/shell/lvconvert-repair.sh
@@ -23,7 +23,7 @@ aux lvmconf 'allocation/mirror_logs_require_separate_pvs = 1'
# fail multiple devices
# 4-way, disk log => 2-way, disk log
-aux prepare_vg 5
+aux prepare_vg 8
lvcreate -m 3 --ig -L 1 -n 4way $vg "$dev1" "$dev2" "$dev3" "$dev4" "$dev5":0
aux disable_dev "$dev2" "$dev4"
echo n | lvconvert --repair $vg/4way 2>&1 | tee 4way.out
@@ -111,4 +111,28 @@ lvconvert -y --repair $vg/mirror
vgreduce --removemissing $vg
aux enable_dev "$dev3"
vgextend $vg "$dev3"
+lvremove -ff $vg
+
+# RAID5 single replace
+lvcreate --type raid5 -i 2 -l 2 -n $lv1 $vg "$dev1" "$dev2" "$dev3"
+aux wait_for_sync $vg $lv1
+aux disable_dev "$dev3"
+lvconvert -y --repair $vg/$lv1
+vgreduce --removemissing $vg
+aux enable_dev "$dev3"
+vgextend $vg "$dev3"
+lvremove -ff $vg
+
+# RAID6 double replace
+lvcreate --type raid5 -i 3 -l 2 -n $lv1 $vg \
+ "$dev1" "$dev2" "$dev3" "$dev4" "$dev5"
+aux wait_for_sync $vg $lv1
+aux disable_dev "$dev4" "$dev5"
+lvconvert -y --repair $vg/$lv1
+vgreduce --removemissing $vg
+aux enable_dev "$dev4"
+aux enable_dev "$dev5"
+vgextend $vg "$dev4" "$dev5"
+lvremove -ff $vg
+
vgremove -ff $vg
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=753cb9204d24ceb4…
Commit: 753cb9204d24ceb4d9f8184ceb4c0262b9aacb42
Parent: 5e36b86c46f04eddae2d4b1f826e1f24995b3636
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Tue Jul 24 14:17:54 2012 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Tue Jul 24 14:17:54 2012 -0500
TEST: Add library functions for checking and waiting for sync
Add 'in_sync' and 'wait_for_sync' to test and wait for synchronization
of a mirror or RAID logical volume.
---
test/lib/aux.sh | 12 ++++++++++++
test/lib/check.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 91f54c9..4128f30 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -479,6 +479,18 @@ udev_wait() {
fi
}
+# wait_for_sync <VG/LV>
+wait_for_sync() {
+ local i
+ for i in {1..500} ; do
+ check in_sync $1 $2 && return
+ sleep .2
+ done
+
+ echo "Sync is taking too long - assume stuck"
+ return 1
+}
+
#
# Check wheter kernel [dm module] target exist
# at least in expected version
diff --git a/test/lib/check.sh b/test/lib/check.sh
index 9c78728..95bba4b 100644
--- a/test/lib/check.sh
+++ b/test/lib/check.sh
@@ -151,6 +151,51 @@ linear() {
$(lvl $lv -o+devices)
}
+# in_sync <VG> <LV>
+# Works for "mirror" and "raid*"
+in_sync() {
+ local a
+ local b
+ local idx
+ local type
+ local lvm_name="$1/$2"
+ local dm_name=$(echo $lvm_name | sed s:-:--: | sed s:/:-:)
+
+ if ! a=(`dmsetup status $dm_name`); then
+ die "Unable to get sync status of $1"
+ elif [ ${a[2]} = "snapshot-origin" ]; then
+ if ! a=(`dmsetup status ${dm_name}-real`); then
+ die "Unable to get sync status of $1"
+ fi
+ fi
+
+ if [ ${a[2]} = "raid" ]; then
+ # Last argument is the sync ratio for RAID
+ idx=$((${#a[@]} - 1))
+ type=${a[3]}
+ elif [ ${a[2]} = "mirror" ]; then
+ # 4th Arg tells us how far to the sync ratio
+ idx=$((${a[3]} + 4))
+ type=${a[2]}
+ else
+ die "Unable to get sync ratio for target type '${a[2]}'"
+ fi
+
+ b=( $(echo ${a[$idx]} | sed s:/:' ':) )
+
+ if [ ${b[0]} != ${b[1]} ]; then
+ echo "$lvm_name ($type) is not in-sync"
+ return 1
+ fi
+
+ if [[ ${a[$(($idx - 1))]} =~ a ]]; then
+ die "$lvm_name in-sync, but 'a' characters in health status"
+ fi
+
+ echo "$lvm_name ($type) is in-sync"
+ return 0
+}
+
active() {
local lv=$1/$2
(get lv_field $lv attr | grep "^....a...$" >/dev/null) || \
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8d5ae472e5226f87…
Commit: 8d5ae472e5226f87175d51722fb5942c531bb8bb
Parent: 48367c5be9b39cd118caeb6b8e554be347d2fd8c
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Jul 19 16:45:08 2012 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Jul 19 16:45:08 2012 +0200
daemon-server: fix error message on daemon shutdown
If a daemon (like lvmetad that is using common daemon-server code)
received a kill signal that was supposed to shut the daemon down,
a spurious message was issued: "Failed to handle a client connection".
This happened if the kill signal came just in the middle of waiting
for a client request in "select" - the request that was supposed to
be handled was blank at that moment of course.
---
WHATS_NEW | 1 +
libdaemon/server/daemon-server.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 925ae23..4f23c39 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.97 -
===============================
+ Do not issue "Failed to handle a client connection" error if lvmetad killed.
Support changing of discard and zeroing for thin pool.
Report used discard for thin pool and volume.
Add support for controlling discard behavior of thin pool.
diff --git a/libdaemon/server/daemon-server.c b/libdaemon/server/daemon-server.c
index 65b28e4..5ca9231 100644
--- a/libdaemon/server/daemon-server.c
+++ b/libdaemon/server/daemon-server.c
@@ -510,7 +510,7 @@ void daemon_start(daemon_state s)
if (select(FD_SETSIZE, &in, NULL, NULL, NULL) < 0 && errno != EINTR)
perror("select error");
if (FD_ISSET(s.socket_fd, &in))
- if (!handle_connect(s))
+ if (!_shutdown_requested && !handle_connect(s))
syslog(LOG_ERR, "Failed to handle a client connection.");
}