Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=95d5877f7af781c5…
Commit: 95d5877f7af781c53c7865868745dc683d2b0413
Parent: 4fd41cf67f0b9ea44a103b059dbbb2d74d8289eb
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jan 3 14:47:46 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jan 3 14:55:16 2017 +0100
cache: add missing udev wait
When we need to clear dirty cache content of cached LV, there
is table reload which usually is shortly followed by next metadata
change. However udev can't (as of now) process udev event
while device is 'suspended'.
So whenever sequence of 'suspend/resume/suspend' is needed,
we need to wait first for finishing of 'resume' processing before
starting next 'suspend'. Otherwise there is 'race' danger of triggering
unwantend umount by systemd as such event will trigger
SYSTEMD_READY=0 state for a moment for such changed device.
Such race is pretty ugly to trace so we may need to review more
sequencies for missing 'sync'.
(Other option is to enhnace 'udev' rules processing to avoid
such dramatic actions to be happening for suspended devices).
---
WHATS_NEW | 1 +
lib/metadata/cache_manip.c | 14 +++++++++++++-
2 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 9e16b27..5fb5904 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.169 -
=====================================
+ Add missing udev sync when flushing dirty cache content.
vgchange -p accepts only uint32 numbers.
Report thin LV date for merged LV when the merge is in progress.
Detect if snapshot merge really started before polling for progress.
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
index 404b1af..cddaf82 100644
--- a/lib/metadata/cache_manip.c
+++ b/lib/metadata/cache_manip.c
@@ -424,9 +424,15 @@ int lv_cache_wait_for_clean(struct logical_volume *cache_lv, int *is_clean)
/* Switch to cleaner policy to flush the cache */
cache_seg->cleaner_policy = 1;
- /* Reaload kernel with "cleaner" policy */
+ /* Reload cache volume with "cleaner" policy */
if (!lv_update_and_reload_origin(cache_lv))
return_0;
+
+ if (!sync_local_dev_names(cache_lv->vg->cmd)) {
+ log_error("Failed to sync local devices when clearing cache volume %s.",
+ display_lvname(cache_lv));
+ return 0;
+ }
}
/*
@@ -436,6 +442,12 @@ int lv_cache_wait_for_clean(struct logical_volume *cache_lv, int *is_clean)
if (1) {
if (!lv_refresh_suspend_resume(lock_lv))
return_0;
+
+ if (!sync_local_dev_names(cache_lv->vg->cmd)) {
+ log_error("Failed to sync local devices after final clearing of cache %s.",
+ display_lvname(cache_lv));
+ return 0;
+ }
}
cache_seg->cleaner_policy = 0;
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4fd41cf67f0b9ea4…
Commit: 4fd41cf67f0b9ea44a103b059dbbb2d74d8289eb
Parent: 9f65a3f0c54fc349da279f9a9e8f1b214945489e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jan 3 13:04:51 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jan 3 14:55:16 2017 +0100
vgchange: max_pv limited to uint32
Solves: https://bugzilla.redhat.com/1280496
The only reasonable behaviour here is to error on
any number out of accepted range (i.e. now numbers
wrapping around with some hidden logic).
As this is plain bug there is no support for
backward compatibility since noone should
set numbers >UINT32_MAX and expect 0 or error
depending on how big number was used....
TODO: more fields might need to be converted.
---
WHATS_NEW | 1 +
test/shell/vgchange-usage.sh | 7 +++++++
tools/args.h | 2 +-
3 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index e5bbfe0..9e16b27 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.169 -
=====================================
+ vgchange -p accepts only uint32 numbers.
Report thin LV date for merged LV when the merge is in progress.
Detect if snapshot merge really started before polling for progress.
Checking LV for merging origin requires also it has merged snapshot.
diff --git a/test/shell/vgchange-usage.sh b/test/shell/vgchange-usage.sh
index 9163741..08d8114 100644
--- a/test/shell/vgchange-usage.sh
+++ b/test/shell/vgchange-usage.sh
@@ -53,6 +53,13 @@ not vgchange -p 2 $vg 2>err
grep "MaxPhysicalVolumes is less than the current number $pv_count of PVs for" err
check vg_field $vg max_pv 128
+# try some numbers around MAX limit (uint32)
+vgchange -p 4294967295 $vg
+invalid vgchange -p 4294967296 $vg
+invalid vgchange -p 18446744073709551615 $vg
+invalid vgchange -p 18446744073709551616 $vg
+check vg_field $vg max_pv 4294967295
+
# vgchange -l MaxLogicalVolumes
check vg_field $vg max_lv 0
invalid vgchange -l -128 $vg
diff --git a/tools/args.h b/tools/args.h
index a04d81d..d5f1186 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -198,7 +198,7 @@ arg(novolumegroup_ARG, 'n', "novolumegroup", NULL, 0, 0)
arg(oldpath_ARG, 'n', "oldpath", NULL, 0, 0)
arg(options_ARG, 'o', "options", string_arg, ARG_GROUPABLE, 0)
arg(sort_ARG, 'O', "sort", string_arg, ARG_GROUPABLE, 0)
-arg(maxphysicalvolumes_ARG, 'p', "maxphysicalvolumes", int_arg, 0, 0)
+arg(maxphysicalvolumes_ARG, 'p', "maxphysicalvolumes", uint32_arg, 0, 0)
arg(permission_ARG, 'p', "permission", permission_arg, 0, 0)
arg(partial_ARG, 'P', "partial", NULL, 0, 0)
arg(physicalvolume_ARG, 'P', "physicalvolume", NULL, 0, 0)