Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4454a580dfd966d0…
Commit: 4454a580dfd966d0cd132a2fd7d0cbb0df7e46a6
Parent: 03621692774e33357acc11ad23d4c8d1faffe971
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Fri May 30 17:26:10 2014 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Fri May 30 17:26:10 2014 -0500
test: use direct I/O when injecting bad data into RAID images
When directly corrupting RAID images for the purpose of testing,
we must use direct I/O (or a 'sync' after the 'dd') to ensure that
the writes are not caught in the buffer cache in a way that is not
reachable by the top-level RAID device.
---
test/shell/lvchange-syncaction-raid.sh | 16 +++++-----------
1 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/test/shell/lvchange-syncaction-raid.sh b/test/shell/lvchange-syncaction-raid.sh
index a27b885..b5fdfb4 100644
--- a/test/shell/lvchange-syncaction-raid.sh
+++ b/test/shell/lvchange-syncaction-raid.sh
@@ -13,7 +13,10 @@
. lib/test
-aux have_raid 1 5 0 || skip
+# Proper mismatch count 1.5.2+ upstream, 1.3.5 < x < 1.4.0 in RHEL6
+aux have_raid 1 3 5 &&
+ ! aux have_raid 1 4 0 ||
+ aux have_raid 1 5 2 || skip
aux prepare_vg 3
lvcreate -n $lv1 $vg -l1 --type raid1
@@ -22,16 +25,7 @@ START=$(get pv_field "$dev2" pe_start --units 1k)
METASIZE=$(get lv_field $vg/${lv1}_rmeta_1 size -a --units 1k)
SEEK=$((${START%\.00k} + ${METASIZE%\.00k}))
# Overwrite some portion of _rimage_1
-dd if=/dev/urandom of="$dev2" bs=1K count=1 seek=$SEEK
-
-lvchange --syncaction check $vg/$lv1
-
-# hmmm it's still in 'dd' buffer and not on real disk ??
-# anyway skip over with 'should'
-should check lv_field $vg/$lv1 raid_mismatch_count "128"
-
-# Ensure it's all on disk now
-sync
+dd if=/dev/urandom of="$dev2" bs=1K count=1 seek=$SEEK oflag=direct
lvchange --syncaction check $vg/$lv1
check lv_field $vg/$lv1 raid_mismatch_count "128"
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=03621692774e3335…
Commit: 03621692774e33357acc11ad23d4c8d1faffe971
Parent: 442820aae3648e1846417d1248fa36030eba4bd8
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri May 30 17:23:54 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri May 30 17:24:07 2014 +0200
report: fix report field type for lv_kernel_major/minor
Should be defined as numeric field, not string field.
---
lib/report/columns.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/report/columns.h b/lib/report/columns.h
index 93b5575..7c36d10 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -36,8 +36,8 @@ FIELD(LVS, lv, STR, "Active", lvid, 6, lvactive, lv_active, "Active state of the
FIELD(LVS, lv, NUM, "Maj", major, 3, int32, lv_major, "Persistent major number or -1 if not persistent.", 0)
FIELD(LVS, lv, NUM, "Min", minor, 3, int32, lv_minor, "Persistent minor number or -1 if not persistent.", 0)
FIELD(LVS, lv, NUM, "Rahead", lvid, 6, lvreadahead, lv_read_ahead, "Read ahead setting in current units.", 0)
-FIELD(LVS, lv, STR, "KMaj", lvid, 4, lvkmaj, lv_kernel_major, "Currently assigned major number or -1 if LV is not active.", 0)
-FIELD(LVS, lv, STR, "KMin", lvid, 4, lvkmin, lv_kernel_minor, "Currently assigned minor number or -1 if LV is not active.", 0)
+FIELD(LVS, lv, NUM, "KMaj", lvid, 4, lvkmaj, lv_kernel_major, "Currently assigned major number or -1 if LV is not active.", 0)
+FIELD(LVS, lv, NUM, "KMin", lvid, 4, lvkmin, lv_kernel_minor, "Currently assigned minor number or -1 if LV is not active.", 0)
FIELD(LVS, lv, NUM, "KRahead", lvid, 7, lvkreadahead, lv_kernel_read_ahead, "Currently-in-use read ahead setting in current units.", 0)
FIELD(LVS, lv, NUM, "LSize", size, 5, size64, lv_size, "Size of LV in current units.", 0)
FIELD(LVS, lv, NUM, "MSize", lvid, 6, lvmetadatasize, lv_metadata_size, "For thin pools, the size of the LV that holds the metadata.", 0)
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=442820aae3648e18…
Commit: 442820aae3648e1846417d1248fa36030eba4bd8
Parent: 8212dac849e5a820c579c06a1b2805e7934a8d8b
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Wed May 28 10:17:15 2014 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Wed May 28 10:17:15 2014 -0500
activation: Remove empty DM device when table fails to load.
As part of better error handling, remove DM devices that have been
sucessfully created but failed to load a table. This can happen
when pvmove'ing in a cluster and the cluster mirror daemon is not
running on a remote node - the mapping table failing to load as a
result. In this case, any revert would work on other nodes running
cmirrord because the DM devices on those nodes did succeed in loading.
However, because no table was able to load on the non-cmirrord nodes,
there is no table present that points to what needs to be reverted.
This causes the empty DM device to remain on the system without being
present in any LVM representation.
This patch should only be considered a partial fix to the overall
problem. This is because only the device which failed to load a
table is removed. Any LVs that may have been loaded as requirements
to the DM device that failed to load may be left in place. Complete
clean-up will require tracking those devices which have been created
as dependencies and removing them along with the device that failed
to load a table.
---
libdm/libdm-deptree.c | 59 ++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 53 insertions(+), 6 deletions(-)
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 0a53755..f34c40f 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -1920,15 +1920,50 @@ static int _create_node(struct dm_tree_node *dnode)
if (!dm_task_no_open_count(dmt))
log_error("Failed to disable open_count");
- if ((r = dm_task_run(dmt)))
- r = dm_task_get_info(dmt, &dnode->info);
-
+ if ((r = dm_task_run(dmt))) {
+ if (!(r = dm_task_get_info(dmt, &dnode->info)))
+ /*
+ * This should not be possible to occur. However,
+ * we print an error message anyway for the more
+ * absurd cases (e.g. memory corruption) so there
+ * is never any question as to which one failed.
+ */
+ log_error(INTERNAL_ERROR
+ "Unable to get DM task info for %s.",
+ dnode->name);
+ }
out:
dm_task_destroy(dmt);
return r;
}
+/*
+ * _remove_node
+ *
+ * This function is only used to remove a DM device that has failed
+ * to load any table.
+ */
+static int _remove_node(struct dm_tree_node *dnode)
+{
+ if (!dnode->info.exists)
+ return 1;
+
+ if (dnode->info.live_table || dnode->info.inactive_table) {
+ log_error(INTERNAL_ERROR
+ "_remove_node called on device with loaded table(s).");
+ return 0;
+ }
+
+ if (!_deactivate_node(dnode->name, dnode->info.major, dnode->info.minor,
+ &dnode->dtree->cookie, dnode->udev_flags, 0)) {
+ log_error("Failed to clean-up device with no table: %s %u:%u",
+ dnode->name ? dnode->name : "",
+ dnode->info.major, dnode->info.minor);
+ return 0;
+ }
+ return 1;
+}
static int _build_dev_string(char *devbuf, size_t bufsize, struct dm_tree_node *node)
{
@@ -2662,7 +2697,7 @@ int dm_tree_preload_children(struct dm_tree_node *dnode,
const char *uuid_prefix,
size_t uuid_prefix_len)
{
- int r = 1;
+ int r = 1, node_created = 0;
void *handle = NULL;
struct dm_tree_node *child;
struct dm_info newinfo;
@@ -2684,13 +2719,25 @@ int dm_tree_preload_children(struct dm_tree_node *dnode,
return_0;
/* FIXME Cope if name exists with no uuid? */
- if (!child->info.exists && !_create_node(child))
+ if (!child->info.exists && !(node_created = _create_node(child)))
return_0;
if (!child->info.inactive_table &&
child->props.segment_count &&
- !_load_node(child))
+ !_load_node(child)) {
+ /*
+ * If the table load does not succeed, we remove the
+ * device in the kernel that would otherwise have an
+ * empty table. This makes the create + load of the
+ * device atomic. However, if other dependencies have
+ * already been created and loaded; this code is
+ * insufficient to remove those - only the node
+ * encountering the table load failure is removed.
+ */
+ if (node_created && !_remove_node(child))
+ return_0;
return_0;
+ }
/* Propagate device size change change */
if (child->props.size_changed)
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8212dac849e5a820…
Commit: 8212dac849e5a820c579c06a1b2805e7934a8d8b
Parent: 2adaef82722ec71620a6d02c6c973d3472d705ae
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 28 15:41:06 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 28 15:41:06 2014 +0200
tests: rename test
---
test/shell/lvmetad-same-uuid.sh | 27 ---------------------------
test/shell/pv-duplicate-uuid.sh | 28 ++++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 27 deletions(-)
diff --git a/test/shell/lvmetad-same-uuid.sh b/test/shell/lvmetad-same-uuid.sh
deleted file mode 100644
index 34cc8eb..0000000
--- a/test/shell/lvmetad-same-uuid.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
-#
-# This copyrighted material is made available to anyone wishing to use,
-# modify, copy, or redistribute it subject to the terms and conditions
-# of the GNU General Public License v.2.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-. lib/test
-
-aux prepare_devs 3
-
-pvcreate "$dev1"
-UUID1=$(get pv_field "$dev1" uuid)
-pvcreate --config "devices{filter=[\"a|$dev2|\",\"r|.*|\"]}" -u "$UUID1" --norestorefile "$dev2"
-pvcreate --config "devices{filter=[\"a|$dev3|\",\"r|.*|\"]}" -u "$UUID1" --norestorefile "$dev3"
-
-pvs -o+uuid |& tee out
-COUNT=$(should grep --count "Found duplicate" out)
-
-# FIXME lvmetad is not able to serve properly this case
-should [ "$COUNT" -eq 2 ]
-
-pvs -o+uuid --config "devices{filter=[\"a|$dev2|\",\"r|.*|\"]}"
diff --git a/test/shell/pv-duplicate-uuid.sh b/test/shell/pv-duplicate-uuid.sh
new file mode 100644
index 0000000..cc5f56b
--- /dev/null
+++ b/test/shell/pv-duplicate-uuid.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# Test 'Found duplicate' is shown
+. lib/test
+
+aux prepare_devs 3
+
+pvcreate "$dev1"
+UUID1=$(get pv_field "$dev1" uuid)
+pvcreate --config "devices{filter=[\"a|$dev2|\",\"r|.*|\"]}" -u "$UUID1" --norestorefile "$dev2"
+pvcreate --config "devices{filter=[\"a|$dev3|\",\"r|.*|\"]}" -u "$UUID1" --norestorefile "$dev3"
+
+pvs -o+uuid |& tee out
+COUNT=$(should grep --count "Found duplicate" out)
+
+# FIXME lvmetad is not able to serve properly this case
+should [ "$COUNT" -eq 2 ]
+
+pvs -o+uuid --config "devices{filter=[\"a|$dev2|\",\"r|.*|\"]}"
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2adaef82722ec716…
Commit: 2adaef82722ec71620a6d02c6c973d3472d705ae
Parent: 171a668e81d9c647677465f042775722a35c5a6e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 28 15:27:14 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 28 15:33:41 2014 +0200
revert: restore original timeout
Accidently it's been commited - but it has also shown,
that on heavy loaded systems (like our test machine could be)
slightly bigger timeouts which waits longer for udev rules
processing does help and avoids occasional refuse of deactivation
because device is still being open.
(i.e. lvcreate...; lvchange -an...)
Unsure how we could now synchronize for this. On very slow(/loaded)
system 5 second timeout is simply not enough.
TODO: introduce at least lvm.conf configurable setting to
allow longer 'retry' loops.
---
lib/activate/activate.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 7ad3654..41d74c7 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -726,7 +726,7 @@ int lv_check_not_in_use(struct cmd_context *cmd, struct logical_volume *lv,
return 0;
}
- usleep(OPEN_COUNT_CHECK_USLEEP_DELAY * 4);
+ usleep(OPEN_COUNT_CHECK_USLEEP_DELAY);
log_debug_activation("Retrying open_count check for %s/%s.",
lv->vg->name, lv->name);
if (!lv_info(cmd, lv, 0, info, 1, 0)) {
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=171a668e81d9c647…
Commit: 171a668e81d9c647677465f042775722a35c5a6e
Parent: ba3e6e7c323a48b64720f7a182d5c8eca0a5613c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 28 15:24:41 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 28 15:33:41 2014 +0200
tests: dd needs to hit disk
Unsure if this is feature or bug of syncaction,
but it needs to be present physically on the media
and it ignores content of buffer cache...
(maybe lvchange should implicitely fsync all disks
that are members of raid array before starting test??)
---
test/shell/lvchange-raid.sh | 17 +----------------
1 files changed, 1 insertions(+), 16 deletions(-)
diff --git a/test/shell/lvchange-raid.sh b/test/shell/lvchange-raid.sh
index 209e094..a229154 100644
--- a/test/shell/lvchange-raid.sh
+++ b/test/shell/lvchange-raid.sh
@@ -157,22 +157,7 @@ run_syncaction_check() {
# Overwrite the last half of one of the PVs with crap
dd if=/dev/urandom of="$device" bs=1k count=$size seek=$seek
-
- if [ -n "$THIN_POSTFIX" ]; then
- #
- # Seems to work fine on real devices,
- # but can't make the system notice the bad blocks
- # in the testsuite - especially when thin is layered
- # on top of RAID. In other cases, I can deactivate
- # and reactivate and it works. Here, even that doesn't
- # work.
- return 0
- lvchange -an $vg/$2
- lvchange -ay $vg/$2
- else
- lvchange -an $vg/$lv
- lvchange -ay $vg/$lv
- fi
+ sync
# "check" should find discrepancies but not change them
# 'lvs' should show results
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ba3e6e7c323a48b6…
Commit: ba3e6e7c323a48b64720f7a182d5c8eca0a5613c
Parent: a67774c1fa315e248504a51804cef9f9bc709b2e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 28 15:23:46 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 28 15:33:41 2014 +0200
tests: raid syncaction activation race
Demonstrace problem of syncaction being called right after activation.
---
test/shell/lvchange-syncaction-raid.sh | 63 ++++++++++++++++++++++++++++++++
1 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvchange-syncaction-raid.sh b/test/shell/lvchange-syncaction-raid.sh
new file mode 100644
index 0000000..a27b885
--- /dev/null
+++ b/test/shell/lvchange-syncaction-raid.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# test activation race for raid's --syncaction check
+
+. lib/test
+
+aux have_raid 1 5 0 || skip
+aux prepare_vg 3
+
+lvcreate -n $lv1 $vg -l1 --type raid1
+
+START=$(get pv_field "$dev2" pe_start --units 1k)
+METASIZE=$(get lv_field $vg/${lv1}_rmeta_1 size -a --units 1k)
+SEEK=$((${START%\.00k} + ${METASIZE%\.00k}))
+# Overwrite some portion of _rimage_1
+dd if=/dev/urandom of="$dev2" bs=1K count=1 seek=$SEEK
+
+lvchange --syncaction check $vg/$lv1
+
+# hmmm it's still in 'dd' buffer and not on real disk ??
+# anyway skip over with 'should'
+should check lv_field $vg/$lv1 raid_mismatch_count "128"
+
+# Ensure it's all on disk now
+sync
+
+lvchange --syncaction check $vg/$lv1
+check lv_field $vg/$lv1 raid_mismatch_count "128"
+
+# Let's deactivate
+lvchange -an $vg/$lv1
+
+# Slow down write by 100ms
+aux delay_dev "$dev2" 0 100
+lvchange -ay $vg/$lv1
+# noone has it open and target is read & running
+dmsetup info -c
+
+#sleep 10 < "$DM_DEV_DIR/$vg/$lv1" &
+# "check" should find discrepancies but not change them
+# 'lvs' should show results
+
+# FIXME
+# this looks like some race with 'write' during activation
+# and syncaction...
+# For now it fails with:
+# device-mapper: message ioctl on failed: Device or resource busy
+#
+lvchange --syncaction check $vg/$lv1
+
+aux enable_dev "$dev2"
+lvs -o+raid_mismatch_count -a $vg
+
+vgremove -ff $vg
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a67774c1fa315e24…
Commit: a67774c1fa315e248504a51804cef9f9bc709b2e
Parent: 9240aca369e210dddb3435433a3c9ac4fe35d357
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue May 27 16:51:57 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue May 27 17:09:05 2014 +0200
tests: detect same uuid on PV
Check we know how to handle same UUID
Test currently does NOT work on lvmetad
(or it's unclear it even should - thus test error
is currently lowered to 'test warning')
TODO: replace lib/test with a better shell script name
---
test/shell/lvmetad-same-uuid.sh | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvmetad-same-uuid.sh b/test/shell/lvmetad-same-uuid.sh
new file mode 100644
index 0000000..34cc8eb
--- /dev/null
+++ b/test/shell/lvmetad-same-uuid.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+. lib/test
+
+aux prepare_devs 3
+
+pvcreate "$dev1"
+UUID1=$(get pv_field "$dev1" uuid)
+pvcreate --config "devices{filter=[\"a|$dev2|\",\"r|.*|\"]}" -u "$UUID1" --norestorefile "$dev2"
+pvcreate --config "devices{filter=[\"a|$dev3|\",\"r|.*|\"]}" -u "$UUID1" --norestorefile "$dev3"
+
+pvs -o+uuid |& tee out
+COUNT=$(should grep --count "Found duplicate" out)
+
+# FIXME lvmetad is not able to serve properly this case
+should [ "$COUNT" -eq 2 ]
+
+pvs -o+uuid --config "devices{filter=[\"a|$dev2|\",\"r|.*|\"]}"