master - libdm: Correct typo.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7dcbf1dfd0bc5e...
Commit: 7dcbf1dfd0bc5e2d057d41900f10016d170bdae2
Parent: f19ec0e36d64bcde6cb4cbd00376fe2377e81b19
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Thu Apr 7 01:51:09 2016 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Thu Apr 7 01:51:09 2016 +0100
libdm: Correct typo.
---
libdm/ioctl/libdm-iface.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
index 8259a78..2733b86 100644
--- a/libdm/ioctl/libdm-iface.c
+++ b/libdm/ioctl/libdm-iface.c
@@ -1830,7 +1830,7 @@ static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command,
dmt->read_only ? "readonly " : "",
dmt->skip_lockfs ? "skiplockfs " : "",
dmt->retry_remove ? "retryremove " : "",
- dmt->deferred_remove ? "defferedremove " : "",
+ dmt->deferred_remove ? "deferredremove " : "",
dmt->secure_data ? "securedata " : "",
dmt->query_inactive_table ? "inactive " : "",
dmt->enable_checks ? "enablechecks " : "",
8 years
master - lvmdump: If dir exists check dir perms too.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f19ec0e36d64bc...
Commit: f19ec0e36d64bcde6cb4cbd00376fe2377e81b19
Parent: 55001ae9ec2c00a070f8dfa8541f4f17a6e2a284
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Apr 6 22:56:45 2016 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Apr 6 22:56:45 2016 +0100
lvmdump: If dir exists check dir perms too.
---
scripts/lvmdump.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/scripts/lvmdump.sh b/scripts/lvmdump.sh
index 19b36d3..a813537 100755
--- a/scripts/lvmdump.sh
+++ b/scripts/lvmdump.sh
@@ -100,7 +100,8 @@ else
fi
if test -d $dir ; then
- (shopt -s nullglob dotglob; cd $dir && files=(*) && ((${#files[@]}))) && die 5 "Fatal: directory $dir already exists and is not empty"
+ (shopt -s nullglob dotglob; test -r $dir -a -w $dir -a -x $dir && cd $dir && files=(*) && ((! ${#files[@]}))) || \
+ die 5 "Fatal: directory $dir already exists and is not empty or inaccessible"
else
test -e $dir && die 3 "Fatal: $dir already exists"
$MKDIR -p $dir || die 4 "Fatal: could not create $dir"
8 years
master - lvmdump: Allow dir to exist already if it is empty
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=55001ae9ec2c00...
Commit: 55001ae9ec2c00a070f8dfa8541f4f17a6e2a284
Parent: 307ab2c179073d28d1c9ec9f995f2849aeab07c6
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Apr 6 22:36:42 2016 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Apr 6 22:36:42 2016 +0100
lvmdump: Allow dir to exist already if it is empty
---
WHATS_NEW | 1 +
scripts/lvmdump.sh | 8 ++++++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 98168a1..b1da1b0 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.150 -
=================================
+ Allow the lvmdump directory to exist already provided it is empty.
Version 2.02.149 - 1st April 2016
=================================
diff --git a/scripts/lvmdump.sh b/scripts/lvmdump.sh
index 1e91a9d..19b36d3 100755
--- a/scripts/lvmdump.sh
+++ b/scripts/lvmdump.sh
@@ -99,8 +99,12 @@ else
dir="$HOME/$dirbase"
fi
-test -e $dir && die 3 "Fatal: $dir already exists"
-$MKDIR -p $dir || die 4 "Fatal: could not create $dir"
+if test -d $dir ; then
+ (shopt -s nullglob dotglob; cd $dir && files=(*) && ((${#files[@]}))) && die 5 "Fatal: directory $dir already exists and is not empty"
+else
+ test -e $dir && die 3 "Fatal: $dir already exists"
+ $MKDIR -p $dir || die 4 "Fatal: could not create $dir"
+fi
log="$dir/lvmdump.log"
8 years
master - tests: do not break teardown on failing losetup
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=307ab2c179073d...
Commit: 307ab2c179073d28d1c9ec9f995f2849aeab07c6
Parent: 07c25429e2b1eb08bb208a6bae015870c7ae635a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 1 09:36:23 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Apr 6 11:54:37 2016 +0200
tests: do not break teardown on failing losetup
Ignore failing 'losetup -d' - i.e. device may have disappeared...
---
test/lib/aux.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 9fd1922..c8985ed 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -431,7 +431,7 @@ teardown_devs() {
test ${#stray_loops[@]} -eq 0 || {
teardown_devs_prefixed "$COMMON_PREFIX" 1
echo "Removing stray loop devices containing $COMMON_PREFIX: ${stray_loops[@]}"
- for i in "${stray_loops[@]}" ; do test ! -b $i || losetup -d $i ; done
+ for i in "${stray_loops[@]}" ; do test ! -b $i || losetup -d $i || true ; done
# Leave test when udev processed all removed devices
udev_wait
}
8 years
master - tests: verify repair of failing mirror
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=07c25429e2b1eb...
Commit: 07c25429e2b1eb08bb208a6bae015870c7ae635a
Parent: 9be7bca4be913f3edc4d4f838d72329475fa8655
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Apr 6 11:50:18 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Apr 6 11:54:36 2016 +0200
tests: verify repair of failing mirror
Improved test script to verify lost mirror image does not
cause mirror corruption while mirror is in use.
TODO: add more cases (lost mlog...), lost image from 3leg mirror...
---
test/shell/lvconvert-repair-mirror.sh | 75 +++++++++++++++++++++++++++++++++
1 files changed, 75 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvconvert-repair-mirror.sh b/test/shell/lvconvert-repair-mirror.sh
new file mode 100644
index 0000000..242028d
--- /dev/null
+++ b/test/shell/lvconvert-repair-mirror.sh
@@ -0,0 +1,75 @@
+#!/bin/sh
+# Copyright (C) 2016 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+MOUNT_DIR=mnt
+
+. lib/inittest
+
+cleanup_mounted_and_teardown()
+{
+ umount "$MOUNT_DIR" || true
+ aux teardown
+}
+
+aux lvmconf 'allocation/mirror_logs_require_separate_pvs = 1'
+
+aux prepare_vg 5
+
+################### Check lost mirror leg #################
+#
+# NOTE: using --regionsize 1M has major impact on my box
+# on read performance while mirror is synchronized
+# with the default 512K - my C2D T61 reads just couple MB/s!
+#
+lvcreate -aey --type mirror -L10 --regionsize 1M -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3"
+mkfs.ext4 "$DM_DEV_DIR/$vg/$lv1"
+mkdir "$MOUNT_DIR"
+
+aux delay_dev "$dev2" 0 500 $(get first_extent_sector "$dev2"):
+aux delay_dev "$dev4" 0 500 $(get first_extent_sector "$dev4"):
+#
+# Enforce syncronization
+# ATM requires unmounted/unused LV??
+#
+lvchange --yes --resync --noudevsync $vg/$lv1
+trap 'cleanup_mounted_and_teardown' EXIT
+mount "$DM_DEV_DIR/$vg/$lv1" "$MOUNT_DIR"
+
+# run 'dd' operation during failure of 'mlog/mimage' device
+
+dd if=/dev/zero of=mnt/zero bs=4K count=100 conv=fdatasync 2>err &
+
+PERCENT=$(get lv_field $vg/$lv1 copy_percent)
+PERCENT=${PERCENT%%\.*} # cut decimal
+test "$PERCENT" -lt 50 # and check less then 50% mirror is in sync
+#lvs -a -o+devices $vg
+
+#aux disable_dev "$dev3"
+aux disable_dev "$dev2"
+
+lvconvert --yes --repair $vg/$lv1
+lvs -a $vg
+
+aux enable_dev "$dev2"
+
+wait
+# dd MAY NOT HAVE produced any error message
+not grep error err
+
+lvs -a -o+devices $vg
+umount "$MOUNT_DIR"
+fsck -n "$DM_DEV_DIR/$vg/$lv1"
+
+aux enable_dev "$dev4"
+lvremove -ff $vg
8 years
master - cleanup: indent
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9be7bca4be913f...
Commit: 9be7bca4be913f3edc4d4f838d72329475fa8655
Parent: 0584e85736b164d07434619622d6d06ad15fe690
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Apr 6 10:28:02 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Apr 6 11:31:02 2016 +0200
cleanup: indent
---
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 7afb439..985d6b9 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1827,7 +1827,7 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
const struct logical_volume *lv_pre_to_free = NULL;
struct logical_volume *lv_pre_tmp;
struct seg_list *sl;
- struct lv_segment *snap_seg;
+ struct lv_segment *snap_seg;
struct lvinfo info;
int r = 0, lockfs = 0, flush_required = 0;
struct detached_lv_data detached;
8 years
master - lvconvert: show percent with %.2
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0584e85736b164...
Commit: 0584e85736b164d07434619622d6d06ad15fe690
Parent: 261a85ced94e2f4ed7c3f01d7d0a7624032e2697
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Apr 5 14:51:05 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Apr 6 11:31:02 2016 +0200
lvconvert: show percent with %.2
lvm2 shows percent values with 2 decimal digits elsewhere so use
it consistently also for this output.
---
tools/lvconvert_poll.c | 4 ++--
tools/polldaemon.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/lvconvert_poll.c b/tools/lvconvert_poll.c
index 9b758f2..3f3beaf 100644
--- a/tools/lvconvert_poll.c
+++ b/tools/lvconvert_poll.c
@@ -152,10 +152,10 @@ progress_t poll_merge_progress(struct cmd_context *cmd,
}
if (parms->progress_display)
- log_print_unless_silent("%s: %s: %.1f%%", lv->name, parms->progress_title,
+ log_print_unless_silent("%s: %s: %.2f%%", lv->name, parms->progress_title,
100.0 - dm_percent_to_float(percent));
else
- log_verbose("%s: %s: %.1f%%", lv->name, parms->progress_title,
+ log_verbose("%s: %s: %.2f%%", lv->name, parms->progress_title,
100.0 - dm_percent_to_float(percent));
if (percent == DM_PERCENT_0)
diff --git a/tools/polldaemon.c b/tools/polldaemon.c
index 8f1ff90..71d6b3e 100644
--- a/tools/polldaemon.c
+++ b/tools/polldaemon.c
@@ -40,10 +40,10 @@ progress_t poll_mirror_progress(struct cmd_context *cmd,
overall_percent = copy_percent(lv);
if (parms->progress_display)
- log_print_unless_silent("%s: %s: %.1f%%", name, parms->progress_title,
+ log_print_unless_silent("%s: %s: %.2f%%", name, parms->progress_title,
dm_percent_to_float(overall_percent));
else
- log_verbose("%s: %s: %.1f%%", name, parms->progress_title,
+ log_verbose("%s: %s: %.2f%%", name, parms->progress_title,
dm_percent_to_float(overall_percent));
if (segment_percent != DM_PERCENT_100)
8 years
master - libdm: improve debug message with ioctl
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=261a85ced94e2f...
Commit: 261a85ced94e2f4ed7c3f01d7d0a7624032e2697
Parent: 5b2227c2c10c2f762e238fedb756850fe4ac5d5d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Apr 5 14:59:59 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Apr 6 11:31:02 2016 +0200
libdm: improve debug message with ioctl
Make the debug message a less difficult to read:
Ioctl shows [ noopencount flush ] instead of cryptic [NF].
---
libdm/ioctl/libdm-iface.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
index 6111cb0..8259a78 100644
--- a/libdm/ioctl/libdm-iface.c
+++ b/libdm/ioctl/libdm-iface.c
@@ -1814,7 +1814,7 @@ static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command,
}
log_debug_activation("dm %s %s%s %s%s%s %s%.0d%s%.0d%s"
- "%s%c%c%s%s%s%s%s%s%s %.0" PRIu64 " %s [%u] (*%u)",
+ "%s[ %s%s%s%s%s%s%s%s%s] %.0" PRIu64 " %s [%u] (*%u)",
_cmd_data_v4[dmt->type].name,
dmt->new_uuid ? "UUID " : "",
dmi->name, dmi->uuid, dmt->newname ? " " : "",
@@ -1825,15 +1825,15 @@ static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command,
dmt->minor > 0 ? dmt->minor : 0,
dmt->major > 0 && dmt->minor == 0 ? "0" : "",
dmt->major > 0 ? ") " : "",
- dmt->no_open_count ? 'N' : 'O',
- dmt->no_flush ? 'N' : 'F',
- dmt->read_only ? "R" : "",
- dmt->skip_lockfs ? "S " : "",
- dmt->retry_remove ? "T " : "",
- dmt->deferred_remove ? "D " : "",
- dmt->secure_data ? "W " : "",
- dmt->query_inactive_table ? "I " : "",
- dmt->enable_checks ? "C" : "",
+ dmt->no_open_count ? "noopencount " : "opencount ",
+ dmt->no_flush ? "noflush " : "flush ",
+ dmt->read_only ? "readonly " : "",
+ dmt->skip_lockfs ? "skiplockfs " : "",
+ dmt->retry_remove ? "retryremove " : "",
+ dmt->deferred_remove ? "defferedremove " : "",
+ dmt->secure_data ? "securedata " : "",
+ dmt->query_inactive_table ? "inactive " : "",
+ dmt->enable_checks ? "enablechecks " : "",
dmt->sector, _sanitise_message(dmt->message),
dmi->data_size, retry_repeat_count);
#ifdef DM_IOCTLS
8 years
master - preload: preserve flushing state
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5b2227c2c10c2f...
Commit: 5b2227c2c10c2f762e238fedb756850fe4ac5d5d
Parent: 7c1937f8df1e843d00b9d5814c756234381ca0d1
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Apr 6 10:29:57 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Apr 6 11:31:02 2016 +0200
preload: preserve flushing state
When leaving preload routine it should not altet state of flush required
when it's been already set to 1 and drop it to 0.
The API here is unclean, but current usage expects the same
variable pointer is for all preload calls and combines 'flush_required'
across all of them.
---
lib/activate/dev_manager.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 994ba80..b3e97db 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -3093,6 +3093,8 @@ int dev_manager_activate(struct dev_manager *dm, const struct logical_volume *lv
int dev_manager_preload(struct dev_manager *dm, const struct logical_volume *lv,
struct lv_activate_opts *laopts, int *flush_required)
{
+ dm->flush_required = *flush_required;
+
if (!_tree_action(dm, lv, laopts, PRELOAD))
return_0;
8 years
master - suspend: fix suspend with noflush limitation
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7c1937f8df1e84...
Commit: 7c1937f8df1e843d00b9d5814c756234381ca0d1
Parent: d4c03cf7b21279ad28b8b9944d0281a55692efcc
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Apr 6 10:29:05 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Apr 6 11:31:02 2016 +0200
suspend: fix suspend with noflush limitation
Commit 844b00958492224c448b30f89ae5532bb6591fd2 tried to move
limit for usage of noflush to 'preload' however this was not
correctly processed.
Intead explicitly check for which types we do not want noflush
and also add debug message in this case.
---
lib/activate/activate.c | 10 ++++++++++
lib/activate/dev_manager.c | 2 +-
2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index a3b2379..7afb439 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1933,6 +1933,16 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
}
}
+ /* Flush is ATM required for the tested cases
+ * NOTE: Mirror repair requires noflush for proper repair!
+ * TODO: Relax this limiting condition further */
+ if (!flush_required &&
+ (lv_is_pvmove(lv) ||
+ (!lv_is_mirror(lv) && !lv_is_thin_pool(lv) && !lv_is_thin_volume(lv)))) {
+ log_debug("Requiring flush for LV %s.", display_lvname(lv));
+ flush_required = 1;
+ }
+
if (!monitor_dev_for_events(cmd, lv, laopts, 0))
/* FIXME Consider aborting here */
stack;
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 22331c3..994ba80 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -3023,7 +3023,7 @@ static int _tree_action(struct dev_manager *dm, const struct logical_volume *lv,
break;
case SUSPEND:
dm_tree_skip_lockfs(root);
- if (!dm->flush_required && !lv_is_pvmove(lv))
+ if (!dm->flush_required)
dm_tree_use_no_flush_suspend(root);
/* Fall through */
case SUSPEND_WITH_LOCKFS:
8 years