Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6c8c8b1b244fc6a6a27c4…
Commit: 6c8c8b1b244fc6a6a27c4b3888844ad8a4750394
Parent: 0000000000000000000000000000000000000000
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: 2017-12-18 20:36 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: 2017-12-18 20:36 +0000
annotated tag: v2_02_177 has been created
at 6c8c8b1b244fc6a6a27c4b3888844ad8a4750394 (tag)
tagging a1f7a483253b11e52ad5460b28cf0c75dba26659 (commit)
replaces v2_02_176
Release 2.02.177.
A wide-ranging bug fix and tidy-up release, covering in particular raid,
pvmove, activation and also switching to aligned 4k blocks when writing
out on-disk volume group metadata.
124 files changed, 3119 insertions(+), 2485 deletions(-)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
iEYEABECAAYFAlo4KDgACgkQIoGRwVZ+LBfTKwCgsJYQcXtiuHP5MWpJcCiZSDvZ
rVkAnRcOvGOnfkpwX7aFrKecuoxjqTyv
=KKDA
-----END PGP SIGNATURE-----
Alasdair G Kergon (31):
post-release
persistent filter: Skip import before rescan
log: Improve various device-related messages
metadata: Remove unused vg.cft_precommitted
metadata: Eliminate redundant nested VG metadata
log: Add io debug class
regenerate man and conf
lvmdiskscan: Remove unnecessary read.
device: log debug when I/O bounce buffer used
label: Remove unused verify functions.
device: categorise block i/o
device: Skip read-modify-write if replacing whole block.
device: Tag I/O for each mda on a device separately in log messages.
lvmetad: drop stray underscore
format_text: Use explicit alignment in wrapping calc.
format_text: Replace PRI with FMT.
format_text: Log additional circular buffer information.
format_text: Move metadata size checking into separate fn.
format_text: Use absolute alignment to calculate metadata usage
format_text: Adjust metadata alignment calculation.
device: Internal error if writing 0 bytes to dev.
metadata: Consistently skip metadata areas that failed.
device: Fix an unpaired device close.
format_text: Refactor and document metadata offset calculation.
format_text: More refactoring of metadata offset calcs
format_text: Change metadata alignment from 512 to 4096.
format_text: Round size written up to multiple of 4096.
format_text: Supply mempool directly to raw_read_mda_header.
format_text: Separate out code paths for buffer wraparound
format_text: Transfer circular buf alloc to device layer.
pre-release
David Teigland (11):
lvmlockd: retry on other sanlock errors
lvmlockd: override unknown lock manager error numbers
man: lvmlockd steps for changing lock type
lvconvert: prevent combining split snapshots in shared vg
lvmlockd: avoid blocking in sanlock_convert
lvmlockd: recognize normal errors from sanlock_convert
lvmlockd: improve error message for VG lock conflict
lvmlockd: fix log print
lvmlockd: use pool lock for tmeta access
lvmlock: return an error if lvb cannot be written
lvmlockd: clear coverity complaint
Eric Ren (1):
clvmd: supress ENOENT error on testing connection
Heinz Mauelshagen (17):
raid: reject conversion request to striped/raid0 on 2-legged raid4/5
raid: reject message for 2-legged raid4/5 -> striped
raid: correct raid6_n_6 -> raid5 convenience type
test: avoid have_raid overhead
test: additional avoid have_raid overhead
raid: add validation checks for reshape flags
raid: ignore --stripesize on raid4/5 conversion to 1 stripe
test: new reshape test under io load
test: disable new reshape test until target version 1.13.1
lv_manip: allow extension on --nosync raid lv
test: cleanup command
test: reduce pv sizes, fix comment and stripe size
test: add large tests skip option
test: allow to succeed in the cluster
deactivate_lvs: deactivate any missing RaidLV legs
test: new raid tests
test: fix trap adding proper teardown to previous, new raid tests
Marian Csontos (15):
test: Rename test nothing methods
test: D-Bus test_nesting requires filter
Update WHATS_NEW
tests: Fix common_dev_ argument handling
Update WHATS_NEW
Update WHATS_NEW
configure: applib is not required by dbusd
lvmdbusd: Fix path to python3
configure: Fix deprecation warning for lvmapp
test: lvmdbusd is used for process name
lvmdbusd: All tools use detected python3
test: Fix condition when detecting lvmdbusd
docs: Add TESTING file
lvmdbusd: Make lvmdbusd executable
lvm2app: Suppress deprecation warnings for our builds
Ondrej Kozina (2):
dmsetup: hide integrity encryption keys on table output
test: check dmsetup hides integrity encryption keys
Zdenek Kabelac (91):
snapshot: prevent repeated merging
coverity: avoid memleak
coverity: avoid overflow_before_widen
blkdeactive: use /sbin for mdamd
shellcheck: fsadm cleanup
cleanup: gcc const warning
cleanup: update messages in lvconvert
cleanup: drop unneeded headerfiles
coverity: add some initilizers
tests: snasphot merging
lvconvert: update delaying message
tests: have some space for 2nd mda
tests: detect racy systemd version
tests: allow to proceed futher with test
raid: protect raid4 activation
cleanup: constify lv parameter
cleanup: remove stack tracing for ok path
reload: do not take backup with suspended devices
lvremove: for unused cache deactive sublv
lv_lock_holder: unused cache-pool is not lock holder
tests: use nonflusing status
pvmove: snapshots need to go with origin device
pvmove: return pvmove itself
layers: collect only lock holding LVs
activate_lvs: deactivate on uniterate
activation: check subLV before skipping resume
activation: suspend pvmove using lv.
pvmove: always flush when working with pvmove tree
activate_lvs: use exclusive activation
cleanup: update log messages
pvmove: change locking on finish
pvmove: activation changes
pvmove: remove unusued code
tests: pvmove supports more cases
suspend: handle start of pvmove
resume: secure critical section
locking: pvmove is locking holding LV
libdm: preload propagates delayed resume
mirror: use lv_update_and_reload_origin
activation: automaticaly discover pvmove holders
pvmove: finish no longer needs explicit resumed
toollib: avoid printing default stripe size
cache: use conditional in warning message
cleanup: reduce couple debug lines
cleanup: using max args consistently
cleanup: update error messages
tests: typo
tests: more places where missing should not appear
activation: enhance holders detection
pvmove: enhance delayed_resume logic
toollib: improve stripes args reading
cmdline: avoid overrun on very large numbers.
cleanup: reuse existing macro
pvmove: move code from tools to lib
pvmove: add missing segment merging
activation: split priority from memory locking
activation: extend resume validation
activation: avoid rechecking pvmove node
suspend: optimize generated list
cleanup: simplify _deps code
cleanup: remove debug code
libdm: watch for failing _info_by_dev
libdm: support for replicator target is dropped
cleanup: drop unused header
cleanup: futher code reduction
cleanup: simplier error message
cleanup: drop impossible test case
cleanup: mark success at the end
cleanup: stack tracing
cleanup: use _node_name
clenaup: use log_warn
cleanup: use log_warn
cleanup: use existing define with prefix
cleanup: drop unused define
cleanup: messsage cleanup
cleanup: drop unneeded check
activation: also lock memory for clustered locking
thin: always clear memory before parsing status
thin: missing type is error
libdm: add help func _get_last_load_segment
libdm: avoid checking status on activation
libdm: use delay_resume_if_extended
libdm: drop extra structure copy
cleanup: reorder calling of pool checking tools
cleanup: use log_warn
debug: update debug msg
vgchange: drop extra counting
activation: keep priority till memlock_unlock
thin: regression fix for metadata checking
cleanup: switch to standard query
cleanup: debug message
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=761691e233fabddfbf678…
Commit: 761691e233fabddfbf678b3a988fce99d39591f4
Parent: 0000000000000000000000000000000000000000
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: 2017-09-13 19:38 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: 2017-09-13 19:38 +0000
annotated tag: v2.02.174 has been created
at 761691e233fabddfbf678b3a988fce99d39591f4 (tag)
tagging 918f0a92daef84867e0df4b422c3de2a36997f17 (commit)
replaces v2_02_173
Release 2.02.174
Assorted fixes and small improvements, including an extension to
dmsetup for activating more than one device with a single command.
As of this release, we're also pushing the code to github:
https://github.com/lvmteam/lvm2
and will handle any issues reported at
https://github.com/lvmteam/lvm2/issues
81 files changed, 1782 insertions(+), 857 deletions(-)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
iEYEABECAAYFAlm5iu8ACgkQIoGRwVZ+LBdCwgCfWI67MvWO3jaZ0/xvgwl5qjU1
KBwAoM8aCqMfl6N6X8jDEhR8FGDoKJ62
=oAdS
-----END PGP SIGNATURE-----
Alasdair G Kergon (14):
post-release
dmsetup: Add concise table output format.
make generate
dmsetup: Add minor number to concise table output format.
tools: Introduce exit code EINIT_FAILED.
toolcontext: Improve invalid units error message.
ioctl: Allow minor without major.
dmsetup: Add --concise to dmsetup create.
lvmconfig: Add options to produce file preamble
pvcreate: Disallow --bootloaderareasize with --restorefile.
pvcreate: Wipe cached bootloaderarea when wiping label.
pvcreate: Use maximum metadata area size with --restorefile
README: Include new github links
pre-release
David Teigland (16):
vgchange: separate change locktype and allow recovery
vgchange: split out code for lockstart and lockstop
vgchange: split out code for systemid
man: remove hyphen escapes from source
commands: expand comment on configuring option vals
lvmlockd: fix lm running check during adoption
lvmlockd: global name doesn't apply to sanlock
commands: recognize -? for help
commands: recognize lvm command -?
lvmlockd: zero extended lvmlock LV
lvmlockd: add comment about temp ls name
lvmlockd: fix mutex unlock
man lvmthin: change fsck references
lvmlockd: print error about starting lock manager
lvmlockd: fix check for no running lock manager
lvmlockd: always disallow mirror splitting
Heinz Mauelshagen (1):
raid: more validation checks for segment data_offset member
Peter Rajnoha (2):
pvcreate: fix check for 2nd mda at end of disk fits if using pvcreate --restorefile
test: pvcreate-bootloaderarea: pvcreate --restorefile --bootloaderarea not supported anymore
Zdenek Kabelac (31):
raid: reshape synchronization point
tidy: declaration names match implementation
thin: warn about too big chunks size
man: fix generated paths
libdm: log_warn
makefiles: RT_LIB
makefiles: use gcc warns with gcc only
makefiles: fixing linking
makefiles: cleanups
tests: update makefile
configure: improve test for realtime clock
configure: tune BUILD_DMEVENTD
makefiles: fix tested vars
makefiles: script executable missed dynamic
makefiles: add DEFS_$@ for cxx
tests: update makefiles
tests: update checked message
libdm: fix errpath for control node creation
lvmlockd: shorter code
lvmcache: check for lvmcache_foreach_mda return code
debug: add stack trace point
locking: avoid descriptor leak for nonblocking mode
daemonize: more unified code
lvmlockd: avoid double unlock of client_mutex
lvmlockctl: fix check for failing close
lvmlockd: log pthread_join errno code
reporting: validate time parsing with strtol
dmsetup: add missing -- for option
dmsetup: validate strtol reading
cleanup: easier to read code
deamonize: restore detection of errors
Zhang Huan (1):
lvmlockd: reduce io impact for finding sanlock lv free lock offset
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c48d22bd3cddfe540413e…
Commit: c48d22bd3cddfe540413ed591ea18399c571a852
Parent: 584ff361dff9dc27a05839ac179899a80007b56e
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Thu Dec 14 15:42:34 2017 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Thu Dec 14 16:45:47 2017 +0100
docs: Add TESTING file
---
TESTING | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 62 insertions(+), 0 deletions(-)
diff --git a/TESTING b/TESTING
new file mode 100644
index 0000000..57932f5
--- /dev/null
+++ b/TESTING
@@ -0,0 +1,62 @@
+LVM2 Test Suite
+===============
+
+The codebase contains many tests in the test subdirectory.
+
+Before running tests
+--------------------
+
+Keep in mind the testsuite MUST run under root user.
+
+It is recommended not to use LVM on the test machine, especially when running
+tests with udev (`make check_system`.)
+
+You MUST disable (or mask) any LVM daemons:
+
+- lvmetad
+- dmeventd
+- lvmpolld
+- lvmdbusd
+- lvmlockd
+- clvmd
+- cmirrord
+
+For running cluster tests, we are using singlenode locking. Pass
+`--with-clvmd=singlenode` to configure.
+
+NOTE: This is useful only for testing, and should not be used in produciton
+code.
+
+To run D-Bus daemon tests, existing D-Bus session is required.
+
+Running tests
+-------------
+
+As root run:
+
+ make check
+
+To run only tests matching a string:
+
+ make check T=test
+
+To skip tests matching a string:
+
+ make check S=test
+
+There are other targets and many environment variables can be used to tweak the
+testsuite - for full list and description run `make -C test help`.
+
+Installing testsuite
+--------------------
+
+It is possible to install and run a testsuite against installed LVM. Run the
+following:
+
+ make -C test install
+
+Then lvm2-testsuite binary can be executed to test installed binaries.
+
+See `lvm2-testsuite --help` for options. The same environment variables can be
+used as with `make check`.
+
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=78ffa44fc58fba6f4e8d2…
Commit: 78ffa44fc58fba6f4e8d2046798783d7f4f11b41
Parent: 643df602c7d199c15ba27958e51e61b822a14755
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Dec 12 20:57:36 2017 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Dec 12 20:57:36 2017 +0000
format_text: Change metadata alignment from 512 to 4096.
If there is sufficient space in the metadata area, align the next
metadata to a disk offset that is a multiple of 4096 bytes and
don't write it circularly. If it doesn't all fit at the end
of the metadata area, go back to the start and write it all there
contiguously.
If there is insufficient space to use the new stricter rules, revert to
the original behaviour, aligning on 512-byte boundaries wrapping around
the circular buffer as required.
---
WHATS_NEW | 1 +
lib/format_text/format-text.c | 70 ++++++++++++++++++++++++++++++++---------
lib/format_text/layout.h | 1 +
3 files changed, 57 insertions(+), 15 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index f6ead67..f871377 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.177 -
====================================
+ Change text format metadata alignment from 512 to 4096 bytes.
When writing metadata, consistently skip mdas marked as failed.
Refactor and adjust text format metadata alignment calculation.
Fix python3 path in lvmdbusd to use value detected by configure.
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 0c5dd1b..ea31a2f 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -488,7 +488,7 @@ static uint64_t _next_rlocn_offset(struct raw_locn *rlocn, struct mda_header *md
if (!rlocn)
/* Find an empty slot */
/* FIXME Assumes only one VG per mdah for now */
- return alignment;
+ return ALIGN_ABSOLUTE(MDA_HEADER_SIZE, mdac_area_start, alignment);
/* First find the end of the old metadata */
old_end = rlocn->offset + rlocn->size;
@@ -501,10 +501,21 @@ static uint64_t _next_rlocn_offset(struct raw_locn *rlocn, struct mda_header *md
/* Calculate new start position relative to start of buffer rounded up to absolute alignment */
new_start_offset = ALIGN_ABSOLUTE(old_end, mdac_area_start, alignment);
- /* If new location is beyond the end of the buffer, wrap around back to start of circular buffer */
- if (new_start_offset >= mdah->size)
- new_start_offset -= (mdah->size - MDA_HEADER_SIZE);
+ /* If new location is beyond the end of the buffer, return to start of circular buffer and realign */
+ if (new_start_offset >= mdah->size) {
+ /* If the start of the buffer is occupied, move past it */
+ if (old_wrapped || rlocn->offset == MDA_HEADER_SIZE)
+ new_start_offset = old_end;
+ else
+ new_start_offset = MDA_HEADER_SIZE;
+
+ new_start_offset = ALIGN_ABSOLUTE(new_start_offset, mdac_area_start, alignment);
+ }
+ /*
+ * Note that we don't check here that this location isn't inside the existing metadata.
+ * If it is, then it means this value of alignment cannot be used.
+ */
return new_start_offset;
}
@@ -640,6 +651,15 @@ static int _metadata_fits_into_buffer(struct mda_context *mdac, struct mda_heade
uint64_t old_start = 0; /* The start of the existing metadata */
uint64_t new_start = mdac->rlocn.offset; /* The proposed start of the new metadata */
+ /*
+ * If the (aligned) start of the new metadata is already beyond the end
+ * of the buffer this means it didn't fit with the given alignment.
+ * (The caller has already tried to wrap it back to the start
+ * of the buffer but the alignment pushed it back outside.)
+ */
+ if (new_start >= mdah->size)
+ return_0;
+
/* Does the total amount of metadata, old and new, fit inside the buffer? */
if (MDA_HEADER_SIZE + (rlocn ? rlocn->size : 0) + mdac->rlocn.size >= mdah->size)
return_0;
@@ -654,7 +674,7 @@ static int _metadata_fits_into_buffer(struct mda_context *mdac, struct mda_heade
old_wrap = old_end - mdah->size;
}
- new_end = new_wrap ? new_wrap + MDA_HEADER_SIZE : (mdac->rlocn.offset + mdac->rlocn.size);
+ new_end = new_wrap ? new_wrap + MDA_HEADER_SIZE : new_start + mdac->rlocn.size;
/* If both wrap around, there's necessarily overlap */
if (new_wrap && old_wrap)
@@ -668,6 +688,10 @@ static int _metadata_fits_into_buffer(struct mda_context *mdac, struct mda_heade
if ((new_wrap || old_wrap) && (new_end > old_start))
return_0;
+ /* If there's no wrap, check there's no overlap */
+ if (!new_wrap && !old_wrap && (old_end > new_start) && (old_start < new_end))
+ return_0;
+
return 1;
}
@@ -681,7 +705,7 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
struct pv_list *pvl;
int r = 0;
uint64_t new_wrap; /* Number of bytes of new metadata that wrap around to start of buffer */
- uint64_t alignment = MDA_ORIGINAL_ALIGNMENT;
+ uint64_t alignment = MDA_ALIGNMENT;
int found = 0;
int noprecommit = 0;
const char *old_vg_name = NULL;
@@ -725,16 +749,32 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
/* Find where the new metadata would be written with our preferred alignment */
mdac->rlocn.offset = _next_rlocn_offset(rlocn, mdah, mdac->area.start, alignment);
- /* Does the new metadata wrap around? */
+ /* If metadata extends beyond the buffer, return to the start instead of wrapping it */
if (mdac->rlocn.offset + mdac->rlocn.size > mdah->size)
- new_wrap = (mdac->rlocn.offset + mdac->rlocn.size) - mdah->size;
- else
- new_wrap = 0;
+ mdac->rlocn.offset = ALIGN_ABSOLUTE(MDA_HEADER_SIZE, mdac->area.start, alignment);
- if (!_metadata_fits_into_buffer(mdac, mdah, rlocn, new_wrap)) {
- log_error("VG %s metadata on %s (" FMTu64 " bytes) too large for circular buffer (" FMTu64 " bytes with " FMTu64 " used)",
- vg->name, dev_name(mdac->area.dev), mdac->rlocn.size, mdah->size - MDA_HEADER_SIZE, rlocn ? rlocn->size : 0);
- goto out;
+ /*
+ * If the metadata doesn't fit into the buffer correctly with these
+ * settings, fall back to the 512-byte alignment used by the original
+ * LVM2 code and allow the metadata to be split into two parts,
+ * wrapping around from the end of the circular buffer back to the
+ * beginning.
+ */
+ if (!_metadata_fits_into_buffer(mdac, mdah, rlocn, 0)) {
+ alignment = MDA_ORIGINAL_ALIGNMENT;
+ mdac->rlocn.offset = _next_rlocn_offset(rlocn, mdah, mdac->area.start, alignment);
+
+ /* Does the new metadata wrap around? */
+ if (mdac->rlocn.offset + mdac->rlocn.size > mdah->size)
+ new_wrap = (mdac->rlocn.offset + mdac->rlocn.size) - mdah->size;
+ else
+ new_wrap = 0;
+
+ if (!_metadata_fits_into_buffer(mdac, mdah, rlocn, new_wrap)) {
+ log_error("VG %s metadata on %s (" FMTu64 " bytes) too large for circular buffer (" FMTu64 " bytes with " FMTu64 " used)",
+ vg->name, dev_name(mdac->area.dev), mdac->rlocn.size, mdah->size - MDA_HEADER_SIZE, rlocn ? rlocn->size : 0);
+ goto out;
+ }
}
log_debug_metadata("Writing %s metadata to %s at " FMTu64 " len " FMTu64 " of " FMTu64 " aligned to " FMTu64,
@@ -1323,7 +1363,7 @@ int vgname_from_mda(const struct format_type *fmt,
(char *)&vgsummary->vgid);
if (mda_free_sectors) {
- current_usage = ALIGN_ABSOLUTE(rlocn->size, dev_area->start + rlocn->offset, MDA_ORIGINAL_ALIGNMENT);
+ current_usage = ALIGN_ABSOLUTE(rlocn->size, dev_area->start + rlocn->offset, MDA_ALIGNMENT);
buffer_size = mdah->size - MDA_HEADER_SIZE;
diff --git a/lib/format_text/layout.h b/lib/format_text/layout.h
index 1746b9c..1eed664 100644
--- a/lib/format_text/layout.h
+++ b/lib/format_text/layout.h
@@ -103,6 +103,7 @@ struct mda_context {
#define LVM2_LABEL "LVM2 001"
#define MDA_SIZE_MIN (8 * (unsigned) lvm_getpagesize())
#define MDA_ORIGINAL_ALIGNMENT 512 /* Original alignment used for start of VG metadata content */
+#define MDA_ALIGNMENT 4096 /* Default alignment in bytes since 2.02.177 for start of VG metadata content. */
int vgname_from_mda(const struct format_type *fmt, struct mda_header *mdah, int primary_mda,
struct device_area *dev_area, struct lvmcache_vgsummary *vgsummary,
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=643df602c7d199c15ba27…
Commit: 643df602c7d199c15ba27958e51e61b822a14755
Parent: 4002f5e206ae89db28eb60bdfb3685bd926fed57
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Dec 12 18:46:25 2017 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Dec 12 18:51:32 2017 +0000
format_text: More refactoring of metadata offset calcs
---
lib/format_text/format-text.c | 30 +++++++++++++++++++++++-------
1 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 174a579..0c5dd1b 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -482,15 +482,24 @@ static struct raw_locn *_find_vg_rlocn(struct device_area *dev_area,
*/
static uint64_t _next_rlocn_offset(struct raw_locn *rlocn, struct mda_header *mdah, uint64_t mdac_area_start, uint64_t alignment)
{
- uint64_t new_start_offset;
+ uint64_t old_end, new_start_offset;
+ int old_wrapped = 0; /* Does the old metadata wrap around? */
if (!rlocn)
/* Find an empty slot */
/* FIXME Assumes only one VG per mdah for now */
return alignment;
+ /* First find the end of the old metadata */
+ old_end = rlocn->offset + rlocn->size;
+
+ if (old_end > mdah->size) {
+ old_wrapped = 1;
+ old_end -= (mdah->size - MDA_HEADER_SIZE);
+ }
+
/* Calculate new start position relative to start of buffer rounded up to absolute alignment */
- new_start_offset = ALIGN_ABSOLUTE(rlocn->offset + rlocn->size, mdac_area_start, alignment);
+ new_start_offset = ALIGN_ABSOLUTE(old_end, mdac_area_start, alignment);
/* If new location is beyond the end of the buffer, wrap around back to start of circular buffer */
if (new_start_offset >= mdah->size)
@@ -626,16 +635,23 @@ static int _metadata_fits_into_buffer(struct mda_context *mdac, struct mda_heade
struct raw_locn *rlocn, uint64_t new_wrap)
{
uint64_t old_wrap = 0; /* Amount of wrap around in existing metadata */
- uint64_t new_end; /* The end location of the new metadata */
+ uint64_t old_end = 0; /* The (byte after the) end of the existing metadata */
+ uint64_t new_end; /* The (byte after the) end of the new metadata */
+ uint64_t old_start = 0; /* The start of the existing metadata */
+ uint64_t new_start = mdac->rlocn.offset; /* The proposed start of the new metadata */
/* Does the total amount of metadata, old and new, fit inside the buffer? */
if (MDA_HEADER_SIZE + (rlocn ? rlocn->size : 0) + mdac->rlocn.size >= mdah->size)
return_0;
- /* Does the existing metadata wrap around the end of the buffer? */
+ /* If there's existing metadata, set old_start, old_end and old_wrap. */
if (rlocn) {
- if (rlocn->offset + rlocn->size > mdah->size)
- old_wrap = (rlocn->offset + rlocn->size) - mdah->size;
+ old_start = rlocn->offset;
+ old_end = old_start + rlocn->size;
+
+ /* Does the existing metadata wrap around the end of the buffer? */
+ if (old_end > mdah->size)
+ old_wrap = old_end - mdah->size;
}
new_end = new_wrap ? new_wrap + MDA_HEADER_SIZE : (mdac->rlocn.offset + mdac->rlocn.size);
@@ -649,7 +665,7 @@ static int _metadata_fits_into_buffer(struct mda_context *mdac, struct mda_heade
return 1;
/* If either wraps around, there's overlap if the new end falls beyond the old start */
- if ((new_wrap || old_wrap) && (new_end > rlocn->offset))
+ if ((new_wrap || old_wrap) && (new_end > old_start))
return_0;
return 1;
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4002f5e206ae89db28eb6…
Commit: 4002f5e206ae89db28eb60bdfb3685bd926fed57
Parent: e932c5da50a22e585a3cd08edb3d849e7715e244
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Dec 12 18:36:54 2017 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Dec 12 18:36:54 2017 +0000
format_text: Refactor and document metadata offset calculation.
---
lib/format_text/format-text.c | 47 +++++++++++++++++++++++++++-------------
1 files changed, 32 insertions(+), 15 deletions(-)
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 154d748..174a579 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -476,7 +476,9 @@ static struct raw_locn *_find_vg_rlocn(struct device_area *dev_area,
}
/*
- * Determine offset for uncommitted metadata
+ * Find first aligned offset after end of existing metadata.
+ * Based on the alignment provided, this is the exact offset to use for the new metadata.
+ * The caller is responsible for validating the result.
*/
static uint64_t _next_rlocn_offset(struct raw_locn *rlocn, struct mda_header *mdah, uint64_t mdac_area_start, uint64_t alignment)
{
@@ -484,7 +486,7 @@ static uint64_t _next_rlocn_offset(struct raw_locn *rlocn, struct mda_header *md
if (!rlocn)
/* Find an empty slot */
- /* FIXME Assume only one VG per mdah for now */
+ /* FIXME Assumes only one VG per mdah for now */
return alignment;
/* Calculate new start position relative to start of buffer rounded up to absolute alignment */
@@ -626,23 +628,28 @@ static int _metadata_fits_into_buffer(struct mda_context *mdac, struct mda_heade
uint64_t old_wrap = 0; /* Amount of wrap around in existing metadata */
uint64_t new_end; /* The end location of the new metadata */
- /* Do we have existing metadata that ends beyond the end of the buffer? */
- if (rlocn && (rlocn->offset + rlocn->size > mdah->size))
- old_wrap = (rlocn->offset + rlocn->size) - mdah->size;
+ /* Does the total amount of metadata, old and new, fit inside the buffer? */
+ if (MDA_HEADER_SIZE + (rlocn ? rlocn->size : 0) + mdac->rlocn.size >= mdah->size)
+ return_0;
- new_end = new_wrap ? new_wrap + MDA_HEADER_SIZE :
- mdac->rlocn.offset + mdac->rlocn.size;
+ /* Does the existing metadata wrap around the end of the buffer? */
+ if (rlocn) {
+ if (rlocn->offset + rlocn->size > mdah->size)
+ old_wrap = (rlocn->offset + rlocn->size) - mdah->size;
+ }
+
+ new_end = new_wrap ? new_wrap + MDA_HEADER_SIZE : (mdac->rlocn.offset + mdac->rlocn.size);
/* If both wrap around, there's necessarily overlap */
if (new_wrap && old_wrap)
return_0;
- /* If either wraps around, does the new end fall beyond the old start? */
- if (rlocn && (new_wrap || old_wrap) && (new_end > rlocn->offset))
- return_0;
+ /* If there's no existing metadata, we're OK */
+ if (!rlocn)
+ return 1;
- /* Does the total amount of metadata, old and new, fit inside the buffer? */
- if (MDA_HEADER_SIZE + (rlocn ? rlocn->size : 0) + mdac->rlocn.size >= mdah->size)
+ /* If either wraps around, there's overlap if the new end falls beyond the old start */
+ if ((new_wrap || old_wrap) && (new_end > rlocn->offset))
return_0;
return 1;
@@ -658,6 +665,7 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
struct pv_list *pvl;
int r = 0;
uint64_t new_wrap; /* Number of bytes of new metadata that wrap around to start of buffer */
+ uint64_t alignment = MDA_ORIGINAL_ALIGNMENT;
int found = 0;
int noprecommit = 0;
const char *old_vg_name = NULL;
@@ -675,6 +683,12 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
if (!found)
return 1;
+ /*
+ * This is paired with the following closes:
+ * - at the end of this fn if returning 0
+ * - in _vg_commit_raw_rlocn regardless of return code
+ * which handles commit (but not pre-commit) and revert.
+ */
if (!dev_open(mdac->area.dev))
return_0;
@@ -692,8 +706,10 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
mdac->rlocn.size = fidtc->raw_metadata_buf_size;
- mdac->rlocn.offset = _next_rlocn_offset(rlocn, mdah, mdac->area.start, MDA_ORIGINAL_ALIGNMENT);
+ /* Find where the new metadata would be written with our preferred alignment */
+ mdac->rlocn.offset = _next_rlocn_offset(rlocn, mdah, mdac->area.start, alignment);
+ /* Does the new metadata wrap around? */
if (mdac->rlocn.offset + mdac->rlocn.size > mdah->size)
new_wrap = (mdac->rlocn.offset + mdac->rlocn.size) - mdah->size;
else
@@ -705,9 +721,9 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
goto out;
}
- log_debug_metadata("Writing %s metadata to %s at " FMTu64 " len " FMTu64 " of " FMTu64,
+ log_debug_metadata("Writing %s metadata to %s at " FMTu64 " len " FMTu64 " of " FMTu64 " aligned to " FMTu64,
vg->name, dev_name(mdac->area.dev), mdac->area.start +
- mdac->rlocn.offset, mdac->rlocn.size - new_wrap, mdac->rlocn.size);
+ mdac->rlocn.offset, mdac->rlocn.size - new_wrap, mdac->rlocn.size, alignment);
/* Write text out, circularly */
if (!dev_write(mdac->area.dev, mdac->area.start + mdac->rlocn.offset,
@@ -837,6 +853,7 @@ static int _vg_commit_raw_rlocn(struct format_instance *fid,
out:
if (!precommit) {
+ /* This is an paired with the open at the start of _vg_write_raw */
if (!dev_close(mdac->area.dev))
stack;
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b96862ee11e0291cc1101…
Commit: b96862ee11e0291cc1101ff4e17e54f9fe8da666
Parent: 15ccea71116f4c0a587aaa0ed25dc1d8d98c0c7f
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Dec 12 17:49:35 2017 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Dec 12 17:52:45 2017 +0000
metadata: Consistently skip metadata areas that failed.
Even after writing some metadata encountered problems, some commands
continue (rightly or wrongly) and attempt to make further changes.
Once an mda is marked MDA_FAILED, don't try to use it again.
This also applies when reverting, where one loop already skips
failed mdas but the other doesn't.
This fixes some device open_count warnings on relevant failure paths.
---
WHATS_NEW | 1 +
lib/metadata/metadata.c | 5 +++++
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 9ff8b51..f6ead67 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.177 -
====================================
+ When writing metadata, consistently skip mdas marked as failed.
Refactor and adjust text format metadata alignment calculation.
Fix python3 path in lvmdbusd to use value detected by configure.
Reduce checks for active LVs in vgchange before background polling.
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 56b5b13..6c55d89 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3039,6 +3039,8 @@ int vg_write(struct volume_group *vg)
/* Write to each copy of the metadata area */
dm_list_iterate_items(mda, &vg->fid->metadata_areas_in_use) {
+ if (mda->status & MDA_FAILED)
+ continue;
if (!mda->ops->vg_write) {
log_error("Format does not support writing volume"
"group metadata areas");
@@ -3063,6 +3065,9 @@ int vg_write(struct volume_group *vg)
dm_list_uniterate(mdah, &vg->fid->metadata_areas_in_use, &mda->list) {
mda = dm_list_item(mdah, struct metadata_area);
+ if (mda->status & MDA_FAILED)
+ continue;
+
if (mda->ops->vg_revert &&
!mda->ops->vg_revert(vg->fid, vg, mda)) {
stack;
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2f4c2a43d49d90875ea31…
Commit: 2f4c2a43d49d90875ea31b1507cd0dfcdb049e88
Parent: b76c6951aa5c41b19fc34342ea2e946d7e0a3d24
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Tue Dec 12 12:14:15 2017 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Dec 12 13:17:07 2017 +0100
test: lvmdbusd is used for process name
lvmdbusd was started, but the process was not recognized by pgrep.
- configure does not make the script executable - set the flag
explicitly when running make check,
- process name changed to lvmdbusd. The previous python3 value
originated from the use of /usr/bin/env.
---
test/lib/aux.sh | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index de63167..a436f84 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -318,7 +318,7 @@ prepare_lvmdbusd() {
# FIXME: This is not correct! Daemon is auto started.
echo -n "## checking lvmdbusd is NOT running..."
- if pgrep -f -l lvmdbusd | grep python3 ; then
+ if pgrep -f -l lvmdbusd | grep python3 || pgrep -x -l lvmdbusd ; then
skip "Cannot run lvmdbusd while existing lvmdbusd process exists"
fi
echo ok
@@ -327,6 +327,10 @@ prepare_lvmdbusd() {
if test -z "${installed_testsuite+varset}"; then
# NOTE: this is always present - additional checks are needed:
daemon="$abs_top_builddir/daemons/lvmdbusd/lvmdbusd"
+ if ! test -x "$daemon" && chmod ugo+x "$daemon"; then
+ echo "Failed to make '$daemon' executable">&2
+ return 1
+ fi
# Setup the python path so we can run
export PYTHONPATH="$abs_top_builddir/daemons"
else
@@ -351,12 +355,9 @@ prepare_lvmdbusd() {
sleep 1
echo -n "## checking lvmdbusd IS running..."
- if ! pgrep -f -l lvmdbusd | grep python3; then
- echo "Failed to start lvmdbusd daemon"
- return 1
- fi
+ comm=
# TODO: Is there a better check than wait 1 second and check pid?
- if ! ps -p $pid -o comm= >/dev/null || [[ $(ps -p $pid -o comm=) != python3 ]]; then
+ if ! comm=$(ps -p $pid -o comm=) >/dev/null || [[ $comm != lvmdbusd ]]; then
echo "Failed to start lvmdbusd daemon"
return 1
fi
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=053d35de473aafe641f59…
Commit: 053d35de473aafe641f595b1182626ea39fc0ab0
Parent: 2db67a8ea09a6f1073583e135bfb7b66228d3526
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Dec 11 17:14:38 2017 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Dec 11 17:14:38 2017 +0000
format_text: Use absolute alignment to calculate metadata usage
Currently both start and offset should always be divisible by alignment,
so this should have no effect, but a later patch will increase alignment
so these variables can no longer be optimised out.
---
lib/format_text/format-text.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 881fd4d..c226131 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -1292,7 +1292,7 @@ int vgname_from_mda(const struct format_type *fmt,
(char *)&vgsummary->vgid);
if (mda_free_sectors) {
- current_usage = ALIGN_ABSOLUTE(rlocn->size, 0, MDA_ORIGINAL_ALIGNMENT);
+ current_usage = ALIGN_ABSOLUTE(rlocn->size, dev_area->start + rlocn->offset, MDA_ORIGINAL_ALIGNMENT);
buffer_size = mdah->size - MDA_HEADER_SIZE;
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=82ae02bc6a6788aabb10a…
Commit: 82ae02bc6a6788aabb10ac8a95287feea37ab88c
Parent: 297d5915c3c927cba3a63bc9d6d1747271d06641
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Dec 7 20:28:03 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Dec 7 21:00:39 2017 +0100
libdm: use delay_resume_if_extended
Update the logic towards more explicit logic.
Preload tree normally does not want to resume, only
in certain cases of extension or new loaded nodes can be
resumed. So introduce new internal variable delay_resume_if_extended
controlable by target.
Patch itself is not changing current existing behaviour,
and rather documents existing problem in more readable way.
lvm2 needs to introduce explicit mechanism how to support more
fain-grained (and safe) logic to i.e. resize thin-pool which
can be sitting on cached raid volume.
---
libdm/libdm-deptree.c | 55 ++++++++++++++++++++++++++++--------------------
1 files changed, 32 insertions(+), 23 deletions(-)
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index f463eab..745fec3 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -233,6 +233,19 @@ struct load_properties {
unsigned delay_resume_if_new;
/*
+ * Preload tree normally only loads and not resume, but there is
+ * automatic resume when target is extended, as it's believed
+ * there can be no i/o flying to this 'new' extedend space
+ * from any device above. Reason is that preloaded target above
+ * may actually need to see its bigger subdevice before it
+ * gets suspended. As long as devices are simple linears
+ * there is no problem to resume bigger device in preload (before commit).
+ * However complex targets like thin-pool (raid,cache...)
+ * they shall not be resumed before their commit.
+ */
+ unsigned delay_resume_if_extended;
+
+ /*
* Call node_send_messages(), set to 2 if there are messages
* When != 0, it validates matching transaction id, thus thin-pools
* where transation_id is passed as 0 are never validated, this
@@ -2745,6 +2758,18 @@ static int _load_node(struct dm_tree_node *dnode)
PRIu64 " for %s.%s", existing_table_size,
seg_start, _node_name(dnode),
dnode->props.size_changed ? "" : " (Ignoring.)");
+
+ /*
+ * FIXME: code here has known design problem.
+ * LVM2 does NOT resize thin-pool on top of other LV in 2 steps -
+ * where raid would be resized with 1st. transaction
+ * followed by 2nd. thin-pool resize - RHBZ #1285063
+ */
+ if (existing_table_size && dnode->props.delay_resume_if_extended) {
+ log_debug_activation("Resume of table of extended device %s delayed.",
+ _node_name(dnode));
+ dnode->props.size_changed = 0;
+ }
}
}
@@ -2791,7 +2816,6 @@ int dm_tree_preload_children(struct dm_tree_node *dnode,
struct dm_tree_node *child;
struct dm_info newinfo;
int update_devs_flag = 0;
- struct load_segment *seg;
/* Preload children first */
while ((child = dm_tree_next_child(&handle, dnode, 0))) {
@@ -2816,6 +2840,10 @@ int dm_tree_preload_children(struct dm_tree_node *dnode,
if (!child->info.exists && !(node_created = _create_node(child)))
return_0;
+ /* Propagate delayed resume from exteded child node */
+ if (child->props.delay_resume_if_extended)
+ dnode->props.delay_resume_if_extended = 1;
+
if (!child->info.inactive_table &&
child->props.segment_count &&
!_load_node(child)) {
@@ -2833,32 +2861,10 @@ int dm_tree_preload_children(struct dm_tree_node *dnode,
return_0;
}
- /* Propagate device size change change */
- if (child->props.size_changed > 0 && !dnode->props.size_changed)
- dnode->props.size_changed = 1;
- else if (child->props.size_changed < 0)
- dnode->props.size_changed = -1;
-
/* No resume for a device without parents or with unchanged or smaller size */
if (!dm_tree_node_num_children(child, 1) || (child->props.size_changed <= 0))
continue;
- if (!node_created && (dm_list_size(&child->props.segs) == 1)) {
- /* If thin-pool child nodes were preloaded WITH changed size
- * skip device resume, as this is likely resize of data or
- * metadata device and so thin pool needs suspend before
- * resume operation.
- * Note: child->props.segment_count is already 0 here
- */
- seg = dm_list_item(dm_list_last(&child->props.segs),
- struct load_segment);
- if (seg->type == SEG_THIN_POOL) {
- log_debug_activation("Skipping resume of thin-pool %s.",
- child->name);
- continue;
- }
- }
-
if (!child->info.inactive_table && !child->info.suspended)
continue;
@@ -3527,6 +3533,9 @@ int dm_tree_node_add_thin_pool_target(struct dm_tree_node *node,
seg->metadata->props.delay_resume_if_new = 0;
seg->pool->props.delay_resume_if_new = 0;
+ /* Preload must not resume extended running thin-pool before it's committed */
+ node->props.delay_resume_if_extended = 1;
+
/* Validate only transaction_id > 0 when activating thin-pool */
node->props.send_messages = transaction_id ? 1 : 0;
seg->transaction_id = transaction_id;
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=297d5915c3c927cba3a63…
Commit: 297d5915c3c927cba3a63bc9d6d1747271d06641
Parent: 4a4ea47f709287444f3b0d8e0581ce17e730ef4c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Dec 7 17:52:01 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Dec 7 21:00:36 2017 +0100
libdm: avoid checking status on activation
Variable props.send_messages has 3 states and was not used properly
here. Activation in this moment does not need to verify thin-pool status
as that has been already checked on preload.
So only if there are some real messages (value 2) call function
for sending them.
---
WHATS_NEW_DM | 1 +
libdm/libdm-deptree.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index dfa5a97..d9503c2 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.146 -
====================================
+ Activation tree of thin pool skips duplicated check of pool status.
Remove code supporting replicator target.
Do not ignore failure of _info_by_dev().
Propagate delayed resume for pvmove subvolumes.
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index ef5da59..f463eab 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -1920,7 +1920,7 @@ int dm_tree_activate_children(struct dm_tree_node *dnode,
* resume should continue further, just whole command
* has to report failure.
*/
- if (r && dnode->props.send_messages &&
+ if (r && (dnode->props.send_messages > 1) &&
!(r = _node_send_messages(dnode, uuid_prefix, uuid_prefix_len, 1)))
stack;
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9e4dc8324117165358f2e…
Commit: 9e4dc8324117165358f2e329e5f9a5b9f27b1e0a
Parent: b910c34f09f45987fe56f0e90455a166e047144c
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Wed Dec 6 10:41:14 2017 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Wed Dec 6 10:41:14 2017 +0100
Update WHATS_NEW
---
WHATS_NEW | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 674e7f1..a5ec3e7 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,7 +1,12 @@
Version 2.02.177 -
====================================
+ Fix lvmlockd to use pool lock when accessing _tmeta volume.
+ Report expected sanlock_convert errors only when retries fail.
+ Avoid blocking in sanlock_convert on SH to EX lock conversion.
+ Deactivate missing raid LV legs (_rimage_X-missing_Y_Z) on decativation.
Skip read-modify-write when entire block is replaced.
Categorise I/O with reason annotations in debug messages.
+ Allow extending of raid LVs created with --nosync after a failed repair.
Command will lock memory only when suspending volumes.
Merge segments when pvmove is finished.
Remove label_verify that has never been used.
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b910c34f09f45987fe56f…
Commit: b910c34f09f45987fe56f0e90455a166e047144c
Parent: b9e419850086473d4309c5211852b0237020421d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Dec 5 14:31:03 2017 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Dec 5 14:31:03 2017 -0600
lvmlockd: use pool lock for tmeta access
When a command is run on a named tmeta LV, use
the lock on the pool.
---
lib/locking/lvmlockd.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index d8bb818..eb7076c 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -2161,6 +2161,10 @@ static int _lockd_lv_thin(struct cmd_context *cmd, struct logical_volume *lv,
/* FIXME: there should be a function to get pool lv from data lv. */
pool_lv = lv_parent(lv);
+ } else if (lv_is_thin_pool_metadata(lv)) {
+ struct lv_segment *pool_seg = get_only_segment_using_this_lv(lv);
+ pool_lv = pool_seg->lv;
+
} else {
/* This should not happen AFAIK. */
log_error("Lock on incorrect thin lv type %s/%s",
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5d5807b238f12cbe1e3ba…
Commit: 5d5807b238f12cbe1e3ba7bbb31e2db2f08ed173
Parent: 46d6f7a6393d1d99411d7896285f6f1556de8547
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Nov 29 15:54:44 2017 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Dec 5 11:53:03 2017 -0600
lvmlockd: improve error message for VG lock conflict
When there is significant VG lock contention which retries
have not been able to mask, print a better error message.
---
lib/locking/lvmlockd.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index 325549a..5870d05 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -1913,6 +1913,23 @@ int lockd_vg(struct cmd_context *cmd, const char *vg_name, const char *def_mode,
}
/*
+ * The lock is held by another host, and retries have been unsuccessful.
+ */
+ if (result == -EAGAIN) {
+ if (!strcmp(mode, "un")) {
+ ret = 1;
+ goto out;
+ } else if (!strcmp(mode, "sh")) {
+ log_warn("VG %s lock skipped: held by other host.", vg_name, result);
+ ret = 1;
+ goto out;
+ } else {
+ log_error("VG %s lock failed: held by other host.", vg_name, result);
+ ret = 0;
+ goto out;
+ }
+ }
+ /*
* No lockspace for the VG was found. It may be a local
* VG that lvmlockd doesn't keep track of, or it may be
* a lockd VG that lvmlockd doesn't yet know about (it hasn't
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bd893348b415d4e604a7f…
Commit: bd893348b415d4e604a7f9a503f17623d485e76e
Parent: 94632eb155a0a1814e69b1baa0516323cbbae648
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Nov 29 14:59:11 2017 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Dec 5 11:53:03 2017 -0600
lvmlockd: avoid blocking in sanlock_convert
Use the same flag as sanlock_acquire() for the
same purpose. sanlock_convert can block like
acquire when doing a sh to ex conversion.
---
daemons/lvmlockd/lvmlockd-sanlock.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-sanlock.c b/daemons/lvmlockd/lvmlockd-sanlock.c
index 358c588..079e952 100644
--- a/daemons/lvmlockd/lvmlockd-sanlock.c
+++ b/daemons/lvmlockd/lvmlockd-sanlock.c
@@ -1688,6 +1688,16 @@ int lm_convert_sanlock(struct lockspace *ls, struct resource *r,
if (daemon_test)
return 0;
+ /*
+ * Don't block waiting for a failed lease to expire since it causes
+ * sanlock_convert to block for a long time, which would prevent this
+ * thread from processing other lock requests.
+ *
+ * FIXME: SANLK_CONVERT_OWNER_NOWAIT is the same as SANLK_ACQUIRE_OWNER_NOWAIT.
+ * Change to use the CONVERT define when the latest sanlock version has it.
+ */
+ flags |= SANLK_ACQUIRE_OWNER_NOWAIT;
+
rv = sanlock_convert(lms->sock, -1, flags, rs);
if (rv == -EAGAIN) {
/* FIXME: When could this happen? Should something different be done? */
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b74e7f6a781bf7dc4914d…
Commit: b74e7f6a781bf7dc4914d8294fcbc6881a539f2e
Parent: 053314f2954dd94f707ef4a6ae9967ecd69fad6e
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Fri Dec 1 18:59:55 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Fri Dec 1 18:59:55 2017 +0100
test: allow to succeed in the cluster
Avoiding "$(get first_extent_sector "$d")" in the loop
allows the test to succeed in the cluster. Further cluster
analysis needed to get to the core reason.
---
test/shell/lvconvert-repair-raid.sh | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvconvert-repair-raid.sh b/test/shell/lvconvert-repair-raid.sh
index c866455..d29b72d 100644
--- a/test/shell/lvconvert-repair-raid.sh
+++ b/test/shell/lvconvert-repair-raid.sh
@@ -25,10 +25,12 @@ aux lvmconf 'allocation/maximise_cling = 0' \
aux prepare_vg 8 80
get_devs
+offset=$(get first_extent_sector $dev1)
+
function delay
{
for d in "${DEVICES[@]}"; do
- aux delay_dev "$d" 0 $1 "$(get first_extent_sector "$d")"
+ aux delay_dev "$d" 0 $1 "$offset"
done
}
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=01b3344cbda712130dec9…
Commit: 01b3344cbda712130dec96924fb3c2bdfe4c595b
Parent: 053314f2954dd94f707ef4a6ae9967ecd69fad6e
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Fri Dec 1 18:57:21 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Fri Dec 1 18:57:21 2017 +0100
test: allow to succeed in the cluster
Avoiding in the loop
allows the test to succeed in the cluster. Further cluster
analysis needed to get to the core reason.
---
test/shell/lvconvert-repair-raid.sh | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvconvert-repair-raid.sh b/test/shell/lvconvert-repair-raid.sh
index c866455..d29b72d 100644
--- a/test/shell/lvconvert-repair-raid.sh
+++ b/test/shell/lvconvert-repair-raid.sh
@@ -25,10 +25,12 @@ aux lvmconf 'allocation/maximise_cling = 0' \
aux prepare_vg 8 80
get_devs
+offset=$(get first_extent_sector $dev1)
+
function delay
{
for d in "${DEVICES[@]}"; do
- aux delay_dev "$d" 0 $1 "$(get first_extent_sector "$d")"
+ aux delay_dev "$d" 0 $1 "$offset"
done
}
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7e794b7748a84d2e8f480…
Commit: 7e794b7748a84d2e8f48012b6c31ba50992c8ac1
Parent: e4db42e4769823aceb59698cef9811c11e330b7b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Nov 30 13:26:44 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 1 12:19:09 2017 +0100
activation: avoid rechecking pvmove node
Use new 3rd. state of trace_pvmove_deps == 2.
In this state we know, we have already seen the node and can skip futher
testing. Remainging value 1 signals we want to track, and value 0
is for ignoring tracking, but node is still checking in this case.
Reduces large amount of duplicate ioctl queries.
---
lib/activate/dev_manager.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 429f4f6..9f19912 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -2059,6 +2059,9 @@ static int _add_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
const char *uuid;
const struct logical_volume *plv;
+ if (lv_is_pvmove(lv) && (dm->track_pvmove_deps == 2))
+ return 1; /* Avoid rechecking of already seen pvmove LV */
+
if (lv_is_cache_pool(lv)) {
if (!dm_list_empty(&lv->segs_using_this_lv)) {
if (!_add_lv_to_dtree(dm, dtree, seg_lv(first_seg(lv), 0), 0))
@@ -2178,8 +2181,8 @@ static int _add_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
return_0;
/* Add any LVs referencing a PVMOVE LV unless told not to. */
- if (dm->track_pvmove_deps && lv_is_pvmove(lv)) {
- dm->track_pvmove_deps = 0;
+ if ((dm->track_pvmove_deps == 1) && lv_is_pvmove(lv)) {
+ dm->track_pvmove_deps = 2; /* Mark as already seen */
dm_list_iterate_items(sl, &lv->segs_using_this_lv) {
/* If LV is snapshot COW - whole snapshot needs reload */
plv = lv_is_cow(sl->seg->lv) ? origin_from_cow(sl->seg->lv) : sl->seg->lv;
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c489dd2e1764216de07be…
Commit: c489dd2e1764216de07be80d36b1025fb4f6fc85
Parent: fbd8b456dbc963bbc306e5b3c643d0f67d3a2d6c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Nov 29 22:19:46 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 1 12:19:09 2017 +0100
pvmove: add missing segment merging
When pvmove is finished and metadata are updated, the code missed
to merge possible mergable segments - so add explicit merging
call after pvmoved volumes are unlocked.
This avoids weird results where i.e. lvs could have been reporting
non-matching segments as lvs upon metadata read is doing silent segment
merging while dm table left after pvmove was still preserving
non-merged segments.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 2 ++
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 32ed3c9..093fc95 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.177 -
====================================
+ Merge segments when pvmove is finished.
Remove label_verify that has never been used.
Ensure very large numbers used as arguments are not casted to lower values.
Enhance reading and validation of options stripes and stripes_size.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index d4a4b8b..fb152ac 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6637,6 +6637,8 @@ int remove_layers_for_segments_all(struct cmd_context *cmd,
dm_list_iterate_items(lvl, lvs_changed) {
/* FIXME Assumes only one pvmove at a time! */
lvl->lv->status &= ~LOCKED;
+ if (!lv_merge_segments(lvl->lv))
+ return_0;
}
return 1;