Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a3cfe9d9b7d77d26…
Commit: a3cfe9d9b7d77d2641b052c33316fda71d05b0d7
Parent: 2be83f45431313947619ac57e9554c59621c371b
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Mon Jan 28 12:32:33 2013 -0600
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Mon Jan 28 12:32:33 2013 -0600
Test (RAID): Test for RAID10 activations when devices are missing
Test the fix for bug 889358. RAID10 had been failing to activate when
there were devices that had failed in more than one mirror set.
---
test/shell/lvchange-partial.sh | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvchange-partial.sh b/test/shell/lvchange-partial.sh
index fe642d4..bc9a514 100644
--- a/test/shell/lvchange-partial.sh
+++ b/test/shell/lvchange-partial.sh
@@ -13,7 +13,7 @@
aux target_at_least dm-raid 1 1 0 || skip
-aux prepare_vg 2
+aux prepare_vg 4
lvcreate --type raid1 -m 1 -l 2 -n $lv1 $vg
lvchange -an $vg/$lv1
@@ -64,3 +64,17 @@ not lvchange --zero y $vg/$lv1
not lvchange --resync -ay $vg/$lv1
not lvchange --resync --addtag foo $vg/$lv1
+aux enable_dev "$dev1"
+lvremove -ff $vg
+
+# rhbz 889358
+# Should be able to activate when RAID10
+# has failed devs in different mirror sets.
+if aux target_at_least dm-raid 1 3 2; then
+ lvcreate --type raid10 -m 1 -i 2 -l 2 -n $lv1 $vg
+ aux wait_for_sync $vg $lv1
+ lvchange -an $vg/$lv1
+ aux disable_dev "$dev1" "$dev3"
+ lvchange -ay $vg/$lv1 --partial
+ lvchange -an $vg/$lv1
+fi
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f7da1caf8deaf50e…
Commit: f7da1caf8deaf50e0597ec377fb035ea3de1ac36
Parent: 8bcc1da2f3f8e5f62af7b9e3a0967f7d1a60b582
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Jan 23 14:45:41 2013 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Jan 23 14:45:41 2013 +0100
blkdeactivate: fix handling of nested mountpoints and mangled mount paths.
If there was a nested mountpoint inside an existing mount path,
blkdeactivate could fail to unmount such a mountpoint as it
needs to deactivate the deepest path first and continue upwards.
For example the simplest reproducer:
[root@rhel6-a ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 4G 0 disk
|-vg-lvol0 (dm-2) 253:2 0 32M 0 lvm /mnt/a
`-vg-lvol1 (dm-3) 253:3 0 32M 0 lvm /mnt/a/b
Before this patch:
[root@rhel6-a ~]# blkdeactivate -u
Deactivating block devices:
UMOUNT: unmounting vg-lvol0 (dm-2) mounted on /mnt/a
umount: /mnt/a: device is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
UMOUNT: unmounting vg-lvol1 (dm-3) mounted on /mnt/a/b
LVM: deactivating Logical Volume vg/lvol1
(deactivation of vg/lvol0 is skipped as /mnt/a that is on lvol0
can't be unmounted - it still has /mnt/a/b as nested mountpoint!)
With this patch applied:
[root@rhel6-a ~]# blkdeactivate -u
Deactivating block devices:
UMOUNT: unmounting vg-lvol1 (dm-3) mounted on /mnt/a/b
UMOUNT: unmounting vg-lvol0 (dm-2) mounted on /mnt/a
LVM: deactivating Logical Volume vg/lvol0
LVM: deactivating Logical Volume vg/lvol1
===
Also, this patch contains a fix for processing mangled mount paths:
[root@rhel6-a ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 4G 0 disk
`-vg-lvol0 (dm-2) 253:2 0 32M 0 lvm /mnt/x y z
[root@rhel6-a ~]# lsblk -r
vg-lvol0 253:2 0 32M 0 lvm /mnt/x\x20y\x20z
(the mount path is mangled with \xNN that is visible in raw
lsblk output only and which is used in blkdeactive as well)
Before this patch:
[root@rhel6-a ~]# blkdeactivate -u
Deactivating block devices:
umount: /mnt/x\x20y\x20z: not found
After this patch applied:
[root@rhel6-a ~]# blkdeactivate -u
Deactivating block devices:
UMOUNT: unmounting vg-lvol0 (dm-2) mounted on /mnt/x\x20y\x20z
LVM: deactivating Logical Volume vg/lvol0
---
WHATS_NEW | 1 +
scripts/blkdeactivate.sh.in | 30 ++++++++++++++++++++++++------
2 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 11afee7..eb8a4a0 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Fix blkdeactivate to handle nested mountpoints and mangled mount paths.
Set locales with LC_ALL instead of lower priority LANG variable.
Fix a crash-inducing race condition in lvmetad.
Add log/debug_classes to lvm.conf to control debug log messages.
diff --git a/scripts/blkdeactivate.sh.in b/scripts/blkdeactivate.sh.in
index 740bac5..849c61d 100644
--- a/scripts/blkdeactivate.sh.in
+++ b/scripts/blkdeactivate.sh.in
@@ -39,6 +39,7 @@ LVM="@sbindir@/lvm"
LSBLK="/bin/lsblk -r --noheadings -o TYPE,KNAME,NAME,MOUNTPOINT"
LSBLK_VARS="local devtype local kname local name local mnt"
LSBLK_READ="read -r devtype kname name mnt"
+SORT_MNT="/bin/sort -r -k 4"
# Do not unmount mounted devices by default.
DO_UMOUNT=0
@@ -122,9 +123,11 @@ is_top_level_device() {
device_umount () {
test -z "$mnt" && return 0;
+ test "$devtype" != "lvm" && test "${kname:0:3}" != "dm-" && return 0
+
if test -z "${SKIP_UMOUNT_LIST["$mnt"]}" -a "$DO_UMOUNT" -eq "1"; then
echo " UMOUNT: unmounting $name ($kname) mounted on $mnt"
- $UMOUNT "$mnt" || add_device_to_skip_list
+ $UMOUNT "$(printf $mnt)" || add_device_to_skip_list
else
echo " [SKIP]: unmount of $name ($kname) mounted on $mnt"
add_device_to_skip_list
@@ -142,9 +145,6 @@ deactivate_holders () {
# check if the device not on the skip list already
test -z ${SKIP_DEVICE_LIST["$kname"]} || return 1
- # try to unmount it if mounted
- device_umount || return 1
-
# try to deactivate the holder
test $skip -eq 1 && skip=0 && continue
deactivate || return 1
@@ -226,7 +226,16 @@ deactivate_all() {
echo "Deactivating block devices:"
if test $# -eq 0; then
- # Deactivate all devices
+ #######################
+ # Process all devices #
+ #######################
+
+ # Unmount all relevant mountpoints first
+ while $LSBLK_READ; do
+ device_umount
+ done <<< "`$LSBLK | $SORT_MNT`"
+
+ # Do deactivate
while $LSBLK_READ; do
# 'disk' is at the bottom already and it's a real device
test "$devtype" = "disk" && continue
@@ -249,8 +258,17 @@ deactivate_all() {
deactivate || skip=1
done <<< "`$LSBLK -s`"
else
- # Deactivate only specified devices
+ ##################################
+ # Process only specified devices #
+ ##################################
+
while test $# -ne 0; do
+ # Unmount all relevant mountpoints first
+ while $LSBLK_READ; do
+ device_umount
+ done <<< "`$LSBLK $1 | $SORT_MNT`"
+
+ # Do deactivate
# Single dm device tree deactivation.
if test -b "$1"; then
$LSBLK_READ <<< "`$LSBLK --nodeps $1`"
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8bcc1da2f3f8e5f6…
Commit: 8bcc1da2f3f8e5f62af7b9e3a0967f7d1a60b582
Parent: 142c4bf9f04a46daf1c3d94581b43ec7c481ba59
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jan 22 11:25:02 2013 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jan 22 11:25:02 2013 +0100
locales: use higher prio LC_ALL variable
For reseting locale environment into significantly less memory
consuming version 'C' - use LC_ALL instead of LANG since it has
higher priority in locale settings.
Otherwise we may observe whole locale-archive which might be
over 100MB on i.e. Fedora systems locked in memory with
some daemons.
---
WHATS_NEW | 1 +
daemons/clvmd/clvmd.c | 4 ++--
daemons/dmeventd/dmeventd.c | 4 ++--
libdaemon/server/daemon-server.c | 4 ++--
scripts/fsadm.sh | 14 +++++++-------
5 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 987cefa..11afee7 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Set locales with LC_ALL instead of lower priority LANG variable.
Fix a crash-inducing race condition in lvmetad.
Add log/debug_classes to lvm.conf to control debug log messages.
Synchronize with udev in pvscan --cache and fix dangling udev_sync cookies.
diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c
index 398e1a4..54cf1ac 100644
--- a/daemons/clvmd/clvmd.c
+++ b/daemons/clvmd/clvmd.c
@@ -440,8 +440,8 @@ int main(int argc, char *argv[])
* used by some glibc (on some distributions it takes over 100MB).
* Daemon currently needs to use mlockall().
*/
- if (setenv("LANG", "C", 1))
- perror("Cannot set LANG to C");
+ if (setenv("LC_ALL", "C", 1))
+ perror("Cannot set LC_ALL to C");
/* Setting debug options on an existing clvmd */
if (debug_opt && !check_local_clvmd()) {
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 5f2339f..55b940f 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1965,8 +1965,8 @@ int main(int argc, char *argv[])
* used by some glibc (on some distributions it takes over 100MB).
* Daemon currently needs to use mlockall().
*/
- if (setenv("LANG", "C", 1))
- perror("Cannot set LANG to C");
+ if (setenv("LC_ALL", "C", 1))
+ perror("Cannot set LC_ALL to C");
if (_restart)
restart();
diff --git a/libdaemon/server/daemon-server.c b/libdaemon/server/daemon-server.c
index 0237465..735a0ea 100644
--- a/libdaemon/server/daemon-server.c
+++ b/libdaemon/server/daemon-server.c
@@ -456,8 +456,8 @@ void daemon_start(daemon_state s)
* some glibc (on some distributions it takes over 100MB). Some daemons
* need to use mlockall().
*/
- if (setenv("LANG", "C", 1))
- perror("Cannot set LANG to C");
+ if (setenv("LC_ALL", "C", 1))
+ perror("Cannot set LC_ALL to C");
#ifdef linux
_systemd_activation = _systemd_handover(&s);
diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh
index 4624a1c..1e8a22a 100755
--- a/scripts/fsadm.sh
+++ b/scripts/fsadm.sh
@@ -213,8 +213,8 @@ detect_mounted() {
# for systems with different device names - check also mount output
if test -z "$MOUNTED" ; then
- MOUNTED=$(LANG=C "$MOUNT" | "$GREP" "^$VOLUME[ \t]")
- test -z "$MOUNTED" && MOUNTED=$(LANG=C "$MOUNT" | "$GREP" "^$RVOLUME[ \t]")
+ MOUNTED=$(LC_ALL=C "$MOUNT" | "$GREP" "^$VOLUME[ \t]")
+ test -z "$MOUNTED" && MOUNTED=$(LC_ALL=C "$MOUNT" | "$GREP" "^$RVOLUME[ \t]")
MOUNTED=${MOUNTED##* on }
MOUNTED=${MOUNTED% type *} # allow type in the mount name
fi
@@ -283,7 +283,7 @@ validate_parsing() {
####################################
resize_ext() {
verbose "Parsing $TUNE_EXT -l \"$VOLUME\""
- for i in $(LANG=C "$TUNE_EXT" -l "$VOLUME"); do
+ for i in $(LC_ALL=C "$TUNE_EXT" -l "$VOLUME"); do
case "$i" in
"Block size"*) BLOCKSIZE=${i##* } ;;
"Block count"*) BLOCKCOUNT=${i##* } ;;
@@ -318,7 +318,7 @@ resize_reiser() {
detect_mounted && verbose "ReiserFS resizes only unmounted filesystem" && try_umount
REMOUNT=$MOUNTED
verbose "Parsing $TUNE_REISER \"$VOLUME\""
- for i in $(LANG=C "$TUNE_REISER" "$VOLUME"); do
+ for i in $(LC_ALL=C "$TUNE_REISER" "$VOLUME"); do
case "$i" in
"Blocksize"*) BLOCKSIZE=${i##*: } ;;
"Count of blocks"*) BLOCKCOUNT=${i##*: } ;;
@@ -347,7 +347,7 @@ resize_xfs() {
temp_mount || error "Cannot mount Xfs filesystem"
fi
verbose "Parsing $TUNE_XFS \"$MOUNTPOINT\""
- for i in $(LANG=C "$TUNE_XFS" "$MOUNTPOINT"); do
+ for i in $(LC_ALL=C "$TUNE_XFS" "$MOUNTPOINT"); do
case "$i" in
"data"*) BLOCKSIZE=${i##*bsize=} ; BLOCKCOUNT=${i##*blocks=} ;;
esac
@@ -389,7 +389,7 @@ resize() {
####################################
# Calclulate diff between two dates
-# LANG=C input is expected the
+# LC_ALL=C input is expected the
# only one supported
####################################
diff_dates() {
@@ -410,7 +410,7 @@ check() {
"ext2"|"ext3"|"ext4")
IFS_CHECK=$IFS
IFS=$NL
- for i in $(LANG=C "$TUNE_EXT" -l "$VOLUME"); do
+ for i in $(LC_ALL=C "$TUNE_EXT" -l "$VOLUME"); do
case "$i" in
"Last mount"*) LASTMOUNT=${i##*: } ;;
"Last checked"*) LASTCHECKED=${i##*: } ;;
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=15fdd5c90dda7f00…
Commit: 15fdd5c90dda7f00f691668c13d5401206d22021
Parent: 6fc596ca90640817fd555942bd5b5d3b7404a177
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Wed Jan 16 11:09:37 2013 +0100
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Wed Jan 16 11:19:33 2013 +0100
lvmetad: Fix a race in metadata update.
The idea is to avoid a period when an existing VG is not mapped to either the
old or the new name. (Note that the brief "blackout" was present even if the
name did not actually change.) We instead allow a brief overlap of a VG existing
under both names, i.e. a query for a VG might succeed but before a lock is
acquired the VG disappears.
---
daemons/lvmetad/lvmetad-core.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index cbd6b09..a789bad 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -454,7 +454,8 @@ static response vg_lookup(lvmetad_state *s, request r)
DEBUGLOG(s, "vg_lookup: updated uuid = %s, name = %s", uuid, name);
- if (!uuid)
+ /* Check the name here. */
+ if (!uuid || !name)
return reply_unknown("VG not found");
cft = lock_vg(s, uuid);
@@ -682,16 +683,14 @@ static int update_metadata(lvmetad_state *s, const char *name, const char *_vgid
lock_vgid_to_metadata(s);
old = dm_hash_lookup(s->vgid_to_metadata, _vgid);
+ oldname = dm_hash_lookup(s->vgid_to_vgname, _vgid);
unlock_vgid_to_metadata(s);
lock_vg(s, _vgid);
seq = dm_config_find_int(metadata, "metadata/seqno", -1);
- if (old) {
+ if (old)
haveseq = dm_config_find_int(old->root, "metadata/seqno", -1);
- oldname = dm_hash_lookup(s->vgid_to_vgname, _vgid);
- assert(oldname);
- }
if (seq < 0)
goto out;
@@ -743,7 +742,7 @@ static int update_metadata(lvmetad_state *s, const char *name, const char *_vgid
if (haveseq >= 0 && haveseq < seq) {
INFO(s, "Updating metadata for %s at %d to %d", _vgid, haveseq, seq);
/* temporarily orphan all of our PVs */
- remove_metadata(s, vgid, 1);
+ update_pvid_to_vgid(s, old, "#orphan", 0);
}
lock_vgid_to_metadata(s);
@@ -753,14 +752,17 @@ static int update_metadata(lvmetad_state *s, const char *name, const char *_vgid
dm_hash_insert(s->vgid_to_metadata, vgid, cft) &&
dm_hash_insert(s->vgid_to_vgname, vgid, cfgname) &&
dm_hash_insert(s->vgname_to_vgid, name, (void*) vgid)) ? 1 : 0;
+
+ if (retval && oldname && strcmp(name, oldname))
+ dm_hash_remove(s->vgname_to_vgid, oldname);
+
unlock_vgid_to_metadata(s);
if (retval)
- /* FIXME: What should happen when update fails */
retval = update_pvid_to_vgid(s, cft, vgid, 1);
unlock_pvid_to_vgid(s);
-out:
+out: /* FIXME: We should probably abort() on partial failures. */
if (!retval && cft)
dm_config_destroy(cft);
unlock_vg(s, _vgid);