Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1a083ffaadcead7c…
Commit: 1a083ffaadcead7c78538a704dca9aef6554540d
Parent: 0000000000000000000000000000000000000000
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: 2016-01-25 01:08 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: 2016-01-25 01:08 +0000
annotated tag: v2_02_141 has been created
at 1a083ffaadcead7c78538a704dca9aef6554540d (tag)
tagging d05d7d974c5e66e9d9eb834df36a4487cb3c1016 (commit)
replaces v2_02_140
Release 2.02.141.
704 files changed, 1502 insertions(+), 1160 deletions(-)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
iEYEABECAAYFAlaldZ4ACgkQIoGRwVZ+LBcyogCg7K/B6AsDwk9exXMspGvAhNEY
iRMAoJKdWR8NZErNMroSbUxSrq+fUWtM
=XjBP
-----END PGP SIGNATURE-----
Alasdair G Kergon (7):
post-release
report: Fix seg_pe_ranges LV sizes.
locking: Add node parameter to query_resource.
activation: Add lv_is_active_remotely.
clvmd: Initialise udev.
activation: remote node check doesn't work yet
pre-release
David Teigland (8):
pvchange, pvresize: fix lockd_gl() usage
lvmlockd: fix lvb validation for conversion
lvmlockd: cosemtic improvements to logging
Revert "Revert "process_each_pv: remove unnecessary workaround""
pvmove: use toollib
toollib: add comment about missing device
lvconvert: disallow test mode in shared VG
lvmlockd: remove noisy log_debug
Peter Rajnoha (15):
report: add kernel_cache_settings field
refactor: add 'delimiter' variable for non-default delimiter when reporting string list
report: change _format_pvsegs to return list instead of plain string, change associated report fields from STR to STR_LIST
report: make devices, metadata_devices, seg_pe_ranges and seg_metadata_le_ranges fields consistent
report: add seg_le_ranges report field
report: add note about seg_pe_ranges and seg_le_ranges in -o help
report: fix off-by-one error when reporting LV segment's metadata device extent count
man: mention GPT id for LVM in pvcreate man page
configure: fix configure to set proper use_blkid_wiping if autodetected as disabled
vgimportclone: fix VG name variable reference in error message after failed PV uuid change
device: also cache device size
lvmcache: invalidate all cached dev sizes if all VGs got unlocked
metadata: check PV dev size is not less than PV size
conf: add metadata/check_pv_device_sizes
tests: add pv-check-dev-size.sh
Zdenek Kabelac (14):
cleanup: use log_print
cleanup: shuffle check of threshold
cleanup: update check function
cleanup: adjust once
cleanup: relocate size assign
cleanup: drop extra cmd passed arg
cleanup: reformat sentence about max sizes
man: dmsetup
man: show hidden pieces
cleanup: join if/else
doc: change fsf address
toollib: use cmd mempool for list
toollib: restore command break support
cleanup: add missing prototype
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bc8f8ac0facc610c…
Commit: bc8f8ac0facc610c3252eb9af592b9c63a935ce2
Parent: 136fd8f2f642c82b132ded4b9a95b05e822e9117
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Jan 22 13:58:35 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Jan 22 14:16:00 2016 +0100
tests: add pv-check-dev-size.sh
---
test/shell/pv-check-dev-size.sh | 44 +++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/test/shell/pv-check-dev-size.sh b/test/shell/pv-check-dev-size.sh
new file mode 100644
index 0000000..8e707fe
--- /dev/null
+++ b/test/shell/pv-check-dev-size.sh
@@ -0,0 +1,44 @@
+#!/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_LVMPOLLD=1
+
+. lib/inittest
+
+aux prepare_pvs 1 8
+
+aux lvmconf 'metadata/check_pv_device_sizes = 1'
+
+CHECK_MSG="smaller than corresponding PV size"
+
+vgcreate $vg $dev1 2>err
+not grep "$CHECK_MSG" err
+pvs 2>err
+not grep "$CHECK_MSG" err
+vgremove -ff $vg
+
+# set PV size to 2x dev size
+pvcreate --setphysicalvolumesize 16m $dev1
+vgcreate $vg $dev1 2>err
+grep "$CHECK_MSG" err
+pvs 2>err
+grep "$CHECK_MSG" err
+vgremove -ff $vg
+
+# should be quiet if requested
+aux lvmconf 'metadata/check_pv_device_sizes = 0'
+pvcreate --setphysicalvolumesize 16m $dev1
+vgcreate $vg $dev1 2>err
+not grep "$CHECK_MSG" err
+pvs 2>err
+not grep "$CHECK_MSG" err
+
+vgremove -ff $vg
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=136fd8f2f642c82b…
Commit: 136fd8f2f642c82b132ded4b9a95b05e822e9117
Parent: c0912af3104cb72ea275d90b8b1d68a25a9ca48a
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Jan 22 13:20:21 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Jan 22 14:16:00 2016 +0100
conf: add metadata/check_pv_device_sizes
---
WHATS_NEW | 1 +
conf/example.conf.in | 11 +++++++++++
lib/commands/toolcontext.c | 2 ++
lib/commands/toolcontext.h | 1 +
lib/config/config_settings.h | 8 ++++++++
lib/metadata/metadata.c | 3 ++-
6 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index ff64846..0eb86e6 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.141 -
====================================
+ Add metadata/check_pv_device_sizes switch to lvm.conf for device size checks.
Warn if device size is less than corresponding PV size in metadata.
Cache device sizes internally.
Restore support for command breaking in process_each_lv_in_vg() (2.02.118).
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 4dbe289..60f8023 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -1415,6 +1415,17 @@ activation {
# This configuration section has an automatic default value.
# metadata {
+ # Configuration option metadata/check_pv_device_sizes.
+ # Check device sizes are not smaller than corresponding PV sizes.
+ # If device size is less than corresponding PV size found in metadata,
+ # there is always a risk of data loss. If this option is set, then LVM
+ # issues a warning message each time it finds that the device size is
+ # less than corresponding PV size. You should not disable this unless
+ # you are absolutely sure about what you are doing!
+ # This configuration option is advanced.
+ # This configuration option has an automatic default value.
+ # check_pv_device_sizes = 1
+
# Configuration option metadata/pvmetadatacopies.
# Number of copies of metadata to store on each PV.
# The --pvmetadatacopies option overrides this setting.
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 90e8abe..4f94df4 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -670,6 +670,8 @@ static int _process_config(struct cmd_context *cmd)
/* LVM stores sizes internally in units of 512-byte sectors. */
init_pv_min_size((uint64_t)pv_min_kb * (1024 >> SECTOR_SHIFT));
+ cmd->check_pv_dev_sizes = find_config_tree_bool(cmd, metadata_check_pv_device_sizes_CFG, NULL);
+
if (!process_profilable_config(cmd))
return_0;
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index e2b5377..5fda9a9 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -113,6 +113,7 @@ struct cmd_context {
* Switches.
*/
unsigned is_long_lived:1; /* optimises persistent_filter handling */
+ unsigned check_pv_dev_sizes:1;
unsigned handles_missing_pvs:1;
unsigned handles_unknown_segments:1;
unsigned use_linear_target:1;
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index d516f83..210a06f 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -1352,6 +1352,14 @@ cfg_array(activation_auto_lock_start_list_CFG, "auto_lock_start_list", activatio
"Locking is auto-started only for VGs selected by this list.\n"
"The rules are the same as those for auto_activation_volume_list.\n")
+cfg(metadata_check_pv_device_sizes_CFG, "check_pv_device_sizes", metadata_CFG_SECTION, CFG_ADVANCED | CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, 1, vsn(2, 2, 141), NULL, 0, NULL,
+ "Check device sizes are not smaller than corresponding PV sizes.\n"
+ "If device size is less than corresponding PV size found in metadata,\n"
+ "there is always a risk of data loss. If this option is set, then LVM\n"
+ "issues a warning message each time it finds that the device size is\n"
+ "less than corresponding PV size. You should not disable this unless\n"
+ "you are absolutely sure about what you are doing!\n")
+
cfg(metadata_pvmetadatacopies_CFG, "pvmetadatacopies", metadata_CFG_SECTION, CFG_ADVANCED | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_PVMETADATACOPIES, vsn(1, 0, 0), NULL, 0, NULL,
"Number of copies of metadata to store on each PV.\n"
"The --pvmetadatacopies option overrides this setting.\n"
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index b9e4121..d8a7128 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -672,7 +672,8 @@ static int _check_pv_dev_sizes(struct volume_group *vg)
uint64_t dev_size, size;
int r = 1;
- if (is_orphan_vg(vg->name))
+ if (!vg->cmd->check_pv_dev_sizes ||
+ is_orphan_vg(vg->name))
return 1;
dm_list_iterate_items(pvl, &vg->pvs) {
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d090d6574e455625…
Commit: d090d6574e455625ad4e2a1a6f3d93f5c663b097
Parent: dc388e0c7af967568527dd1bccb0361ca668f09b
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Jan 15 16:41:27 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Jan 22 14:13:34 2016 +0100
device: also cache device size
Add "size" and "size_seqno" to struct device to cache device's size
and also to control its lifetime - the cached value is valid as long
as the global _dev_size_seqno is equal to the device's size_seqno,
otherwise we need to get the size again and cache the new value.
This patch also adds new dev_size_seqno_inc() fn for the appropriate
parts of the code to increment current global value of _dev_size_seqno
and hence to cause all currently cached values for device sizes to
be invalidated.
The device size is now cached because we're planning to reuse this
information for further checks and we want to avoid checking it more
than necessary to save resources.
---
WHATS_NEW | 1 +
lib/device/dev-io.c | 26 +++++++++++++++++++++++++-
lib/device/device.h | 9 +++++++++
3 files changed, 35 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 6342041..f6fd967 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.141 -
====================================
+ Cache device sizes internally.
Restore support for command breaking in process_each_lv_in_vg() (2.02.118).
Use correct mempool when process_each_lv_in_vg() (2.02.118).
Fix lvm.8 man to show again prohibited suffixes.
diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c
index 8c58786..f8b24bf 100644
--- a/lib/device/dev-io.c
+++ b/lib/device/dev-io.c
@@ -54,6 +54,7 @@
#endif
static DM_LIST_INIT(_open_devices);
+static unsigned _dev_size_seqno = 1;
/*-----------------------------------------------------------------
* The standard io loop that keeps submitting an io until it's
@@ -271,11 +272,18 @@ out:
return r;
}
-static int _dev_get_size_file(const struct device *dev, uint64_t *size)
+static int _dev_get_size_file(struct device *dev, uint64_t *size)
{
const char *name = dev_name(dev);
struct stat info;
+ if (dev->size_seqno == _dev_size_seqno) {
+ log_very_verbose("%s: using cached size %" PRIu64 " sectors",
+ name, dev->size);
+ *size = dev->size;
+ return 1;
+ }
+
if (stat(name, &info)) {
log_sys_error("stat", name);
return 0;
@@ -283,6 +291,8 @@ static int _dev_get_size_file(const struct device *dev, uint64_t *size)
*size = info.st_size;
*size >>= SECTOR_SHIFT; /* Convert to sectors */
+ dev->size = *size;
+ dev->size_seqno = _dev_size_seqno;
log_very_verbose("%s: size is %" PRIu64 " sectors", name, *size);
@@ -293,6 +303,13 @@ static int _dev_get_size_dev(struct device *dev, uint64_t *size)
{
const char *name = dev_name(dev);
+ if (dev->size_seqno == _dev_size_seqno) {
+ log_very_verbose("%s: using cached size %" PRIu64 " sectors",
+ name, dev->size);
+ *size = dev->size;
+ return 1;
+ }
+
if (!dev_open_readonly(dev))
return_0;
@@ -304,6 +321,9 @@ static int _dev_get_size_dev(struct device *dev, uint64_t *size)
}
*size >>= BLKSIZE_SHIFT; /* Convert to sectors */
+ dev->size = *size;
+ dev->size_seqno = _dev_size_seqno;
+
if (!dev_close(dev))
log_sys_error("close", name);
@@ -373,6 +393,10 @@ static int _dev_discard_blocks(struct device *dev, uint64_t offset_bytes, uint64
/*-----------------------------------------------------------------
* Public functions
*---------------------------------------------------------------*/
+void dev_size_seqno_inc(void)
+{
+ _dev_size_seqno++;
+}
int dev_get_size(struct device *dev, uint64_t *size)
{
diff --git a/lib/device/device.h b/lib/device/device.h
index a1ba80c..6b01fb6 100644
--- a/lib/device/device.h
+++ b/lib/device/device.h
@@ -62,6 +62,8 @@ struct device {
int block_size;
int read_ahead;
uint32_t flags;
+ unsigned size_seqno;
+ uint64_t size;
uint64_t end;
struct dm_list open_list;
struct dev_ext ext;
@@ -91,6 +93,13 @@ struct dev_ext *dev_ext_get(struct device *dev);
int dev_ext_release(struct device *dev);
/*
+ * Increment current dev_size_seqno.
+ * This is used to control lifetime
+ * of cached device size.
+ */
+void dev_size_seqno_inc(void);
+
+/*
* All io should use these routines.
*/
int dev_get_block_size(struct device *dev, unsigned int *phys_block_size, unsigned int *block_size);