master - lvmlockd: don't adopt locks from unused lm
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=762b0d697ff745...
Commit: 762b0d697ff7456d0a450121e41eff00cd5a7f08
Parent: 0ad40a76c0603147f9b945f7492ad721e7f95edb
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Jan 28 09:42:45 2016 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jan 28 09:42:45 2016 -0600
lvmlockd: don't adopt locks from unused lm
When built without dlm or sanlock support, don't
attempt to adopt locks from that lm.
---
daemons/lvmlockd/lvmlockd-core.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index 4cd3284..292d19c 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -5153,13 +5153,17 @@ static void adopt_locks(void)
* This is expected for at least one of them.
*/
- rv = lm_get_lockspaces_dlm(&ls_found);
- if ((rv < 0) && (rv != -ECONNREFUSED))
- goto fail;
+ if (lm_support_dlm()) {
+ rv = lm_get_lockspaces_dlm(&ls_found);
+ if ((rv < 0) && (rv != -ECONNREFUSED))
+ goto fail;
+ }
- rv = lm_get_lockspaces_sanlock(&ls_found);
- if ((rv < 0) && (rv != -ECONNREFUSED))
- goto fail;
+ if (lm_support_sanlock()) {
+ rv = lm_get_lockspaces_sanlock(&ls_found);
+ if ((rv < 0) && (rv != -ECONNREFUSED))
+ goto fail;
+ }
if (list_empty(&ls_found)) {
log_debug("No lockspaces found to adopt");
7 years, 8 months
v2_02_141 annotated tag has been created
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1a083ffaadcead...
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
7 years, 8 months
master - post-release
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0ad40a76c06031...
Commit: 0ad40a76c0603147f9b945f7492ad721e7f95edb
Parent: d05d7d974c5e66e9d9eb834df36a4487cb3c1016
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Jan 25 01:12:27 2016 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Jan 25 01:12:27 2016 +0000
post-release
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 3 +++
WHATS_NEW_DM | 3 +++
4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/VERSION b/VERSION
index df57cab..2cb3303 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.141(2)-git (2016-01-25)
+2.02.142(2)-git (2016-01-25)
diff --git a/VERSION_DM b/VERSION_DM
index 32af08f..17b06bb 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.115-git (2016-01-25)
+1.02.116-git (2016-01-25)
diff --git a/WHATS_NEW b/WHATS_NEW
index cce926e..96c7cd6 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,3 +1,6 @@
+Version 2.02.142 -
+====================================
+
Version 2.02.141 - 25th January 2016
====================================
Add metadata/check_pv_device_sizes switch to lvm.conf for device size checks.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 7ddcfd7..2fb1274 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,3 +1,6 @@
+Version 1.02.116 -
+====================================
+
Version 1.02.115 - 25th January 2016
====================================
Fix man page for dmsetup udevcreatecookie.
7 years, 8 months
master - pre-release
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d05d7d974c5e66...
Commit: d05d7d974c5e66e9d9eb834df36a4487cb3c1016
Parent: bc8f8ac0facc610c3252eb9af592b9c63a935ce2
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Jan 25 01:08:16 2016 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Jan 25 01:08:16 2016 +0000
pre-release
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 2 +-
WHATS_NEW_DM | 4 ++--
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/VERSION b/VERSION
index 5bdba32..df57cab 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.141(2)-git (2016-01-16)
+2.02.141(2)-git (2016-01-25)
diff --git a/VERSION_DM b/VERSION_DM
index dcf06e1..32af08f 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.115-git (2016-01-16)
+1.02.115-git (2016-01-25)
diff --git a/WHATS_NEW b/WHATS_NEW
index 0eb86e6..cce926e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,4 +1,4 @@
-Version 2.02.141 -
+Version 2.02.141 - 25th January 2016
====================================
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.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index df3613b..7ddcfd7 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,5 @@
-Version 1.02.115 -
-=====================================
+Version 1.02.115 - 25th January 2016
+====================================
Fix man page for dmsetup udevcreatecookie.
Version 1.02.114 - 14th December 2015
7 years, 8 months
master - tests: add pv-check-dev-size.sh
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bc8f8ac0facc61...
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
7 years, 8 months
master - conf: add metadata/check_pv_device_sizes
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=136fd8f2f642c8...
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) {
7 years, 8 months
master - metadata: check PV dev size is not less than PV size
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c0912af3104cb7...
Commit: c0912af3104cb72ea275d90b8b1d68a25a9ca48a
Parent: 1f5dfb7369600c169ecd2c78e0cd079ad1442548
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Jan 22 11:37:09 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Jan 22 14:16:00 2016 +0100
metadata: check PV dev size is not less than PV size
---
WHATS_NEW | 1 +
lib/metadata/metadata.c | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index f6fd967..ff64846 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.141 -
====================================
+ 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).
Use correct mempool when process_each_lv_in_vg() (2.02.118).
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index e733f6e..b9e4121 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -666,6 +666,34 @@ int vg_check_pv_dev_block_sizes(const struct volume_group *vg)
return 1;
}
+static int _check_pv_dev_sizes(struct volume_group *vg)
+{
+ struct pv_list *pvl;
+ uint64_t dev_size, size;
+ int r = 1;
+
+ if (is_orphan_vg(vg->name))
+ return 1;
+
+ dm_list_iterate_items(pvl, &vg->pvs) {
+ if (is_missing_pv(pvl->pv))
+ continue;
+
+ dev_size = pv_dev_size(pvl->pv);
+ size = pv_size(pvl->pv);
+
+ if (dev_size < size) {
+ log_warn("Device %s has size of %" PRIu64 " sectors which "
+ "is smaller than corresponding PV size of %" PRIu64
+ " sectors. Was device resized?",
+ pv_dev_name(pvl->pv), dev_size, size);
+ r = 0;
+ }
+ }
+
+ return r;
+}
+
/*
* Extend a VG by a single PV / device path
*
@@ -742,6 +770,8 @@ int vg_extend(struct volume_group *vg, int pv_count, const char *const *pv_names
dm_free(pv_name);
}
+ (void) _check_pv_dev_sizes(vg);
+
/* FIXME Decide whether to initialise and add new mdahs to format instance */
return 1;
@@ -4031,6 +4061,10 @@ struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vgnam
if (!(vg = _vg_read(cmd, vgname, vgid, warn_flags, consistent, 0)))
goto_out;
+ if (!_check_pv_dev_sizes(vg))
+ log_warn("One or more devices used as PVs in VG %s "
+ "have changed sizes.", vg->name);
+
if (!check_pv_segments(vg)) {
log_error(INTERNAL_ERROR "PV segments corrupted in %s.",
vg->name);
7 years, 8 months
master - lvmcache: invalidate all cached dev sizes if all VGs got unlocked
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1f5dfb7369600c...
Commit: 1f5dfb7369600c169ecd2c78e0cd079ad1442548
Parent: d090d6574e455625ad4e2a1a6f3d93f5c663b097
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Jan 22 11:13:00 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Jan 22 14:16:00 2016 +0100
lvmcache: invalidate all cached dev sizes if all VGs got unlocked
---
lib/cache/lvmcache.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 2864ffb..4a4b53f 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -452,8 +452,10 @@ void lvmcache_unlock_vgname(const char *vgname)
dm_hash_remove(_lock_hash, vgname);
/* FIXME Do this per-VG */
- if (strcmp(vgname, VG_GLOBAL) && !--_vgs_locked)
+ if (strcmp(vgname, VG_GLOBAL) && !--_vgs_locked) {
dev_close_all();
+ dev_size_seqno_inc(); /* invalidate all cached dev sizes */
+ }
}
int lvmcache_vgs_locked(void)
7 years, 8 months
master - device: also cache device size
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d090d6574e4556...
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);
7 years, 8 months
master - lvmlockd: remove noisy log_debug
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=dc388e0c7af967...
Commit: dc388e0c7af967568527dd1bccb0361ca668f09b
Parent: 55056c2d16a6cb6e0ce5b7179d62d4dc28cd790d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Jan 21 14:37:15 2016 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jan 21 14:37:15 2016 -0600
lvmlockd: remove noisy log_debug
The debug message appeared even when lvmlockd was not used,
and the lockd operation was simply being skipped.
---
lib/locking/lvmlockd.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index 1af40b7..a33544c 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -1702,10 +1702,8 @@ int lockd_vg(struct cmd_context *cmd, const char *vg_name, const char *def_mode,
* passed back to lockd_vg() for the corresponding unlock.
*/
if (def_mode && !strcmp(def_mode, "un")) {
- if (prev_state & LDST_FAIL) {
- log_debug("VG %s unlock skipped: lockd_state is failed", vg_name);
+ if (prev_state & LDST_FAIL)
return 1;
- }
mode = "un";
goto req;
7 years, 8 months