master - config: change scan_lvs default to 0
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7be6791e707da333e56...
Commit: 7be6791e707da333e56aea3cc50c079ab6207bad
Parent: 0aa51a2f6129bf05d9897894a7abae627f05ce45
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Feb 20 13:30:46 2019 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Feb 20 13:30:46 2019 -0600
config: change scan_lvs default to 0
so that lvm does not scan LVs for PVs by default.
---
lib/config/defaults.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index 06a5ecf..cb013c6 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -310,7 +310,7 @@
#define DEFAULT_VDO_POOL_AUTOEXTEND_THRESHOLD 100
#define DEFAULT_VDO_POOL_AUTOEXTEND_PERCENT 20
-#define DEFAULT_SCAN_LVS 1
+#define DEFAULT_SCAN_LVS 0
#define DEFAULT_HINTS "all"
5 years, 2 months
master - hints: fix recreating hints from pvscan
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0aa51a2f6129bf05d98...
Commit: 0aa51a2f6129bf05d9897894a7abae627f05ce45
Parent: 3ebce8dbd2d9afc031e0737f8feed796ec7a8df9
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Feb 13 15:23:43 2019 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Feb 13 15:23:43 2019 -0600
hints: fix recreating hints from pvscan
When aay was included in the pvscan --cache command,
the activation part was complaining about the unusual
state of the hint file since it had been recreated
just prior.
---
lib/label/hints.c | 30 +++++++++++++++++++++++++++++-
lib/label/hints.h | 2 ++
tools/pvscan.c | 11 +++++++----
3 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/lib/label/hints.c b/lib/label/hints.c
index 4fe44b0..a2e7646 100644
--- a/lib/label/hints.c
+++ b/lib/label/hints.c
@@ -1026,6 +1026,34 @@ void clear_hint_file(struct cmd_context *cmd)
}
/*
+ * This is only used at the start of pvscan --cache [-aay] to
+ * set up for recreating the hint file.
+ */
+void pvscan_recreate_hints_begin(struct cmd_context *cmd)
+{
+ /* No commands are using hints. */
+ if (!cmd->enable_hints)
+ return;
+
+ log_debug("pvscan_recreate_hints_begin");
+
+ if (!_touch_hints())
+ return;
+
+ /* limit potential delay blocking on hints lock next */
+ if (!_touch_nohints())
+ stack;
+
+ if (!_lock_hints(LOCK_EX, 0))
+ stack;
+
+ _unlink_nohints();
+
+ if (!_clear_hints(cmd))
+ stack;
+}
+
+/*
* This is used when pvscan --cache sees a new PV, which
* means we should refresh hints. It could catch some case
* which the other methods of detecting stale hints may miss.
@@ -1136,7 +1164,7 @@ int get_hints(struct cmd_context *cmd, struct dm_list *hints, int *newhints,
* so this has to be checked before the cmd->use_hints check.
*/
if (cmd->pvscan_recreate_hints) {
- /* clear_hint_file already locked hints ex */
+ /* pvscan_recreate_hints_begin already locked hints ex */
/* create new hints after scan */
log_debug("get_hints: pvscan recreate");
*newhints = NEWHINTS_FILE;
diff --git a/lib/label/hints.h b/lib/label/hints.h
index 469e8c4..0134f1e 100644
--- a/lib/label/hints.h
+++ b/lib/label/hints.h
@@ -37,5 +37,7 @@ int validate_hints(struct cmd_context *cmd, struct dm_list *hints);
void hints_exit(void);
+void pvscan_recreate_hints_begin(struct cmd_context *cmd);
+
#endif
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 098c502..55b6f5f 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -660,17 +660,20 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
if (!argc && !devno_args) {
/*
* pvscan --cache removes existing hints and recreates new ones.
- * We begin by clearing hints at the start of the command like
- * vgcreate would do. The pvscan_recreate_hints flag is used
- * to enable the special case hint recreation in label_scan.
+ * We begin by clearing hints at the start of the command.
+ * The pvscan_recreate_hints flag is used to enable the
+ * special case hint recreation in label_scan.
*/
cmd->pvscan_recreate_hints = 1;
- clear_hint_file(cmd);
+ pvscan_recreate_hints_begin(cmd);
log_verbose("pvscan all devices.");
_online_pvid_files_remove();
_online_pvscan_all_devs(cmd, NULL, NULL);
all_vgs = 1;
+
+ cmd->pvscan_recreate_hints = 0;
+ cmd->use_hints = 0;
goto activate;
}
5 years, 2 months
master - apply obtain_device_list_from_udev to all libudev usage
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3ebce8dbd2d9afc031e...
Commit: 3ebce8dbd2d9afc031e0737f8feed796ec7a8df9
Parent: d19e3727951853093828b072e254e447f7d61c60
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Feb 5 10:15:40 2019 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Feb 5 10:15:40 2019 -0600
apply obtain_device_list_from_udev to all libudev usage
udev_dev_is_md_component and udev_dev_is_mpath_component
are not used for obtaining the device list, but they still
use libudev for device info. When there are problems with
udev, these functions can get stuck. So, use the existing
obtain_device_list_from_udev config setting to also control
whether these "is component" functions are used, which gives
us a way to avoid using libudev entirely when it's causing
problems.
---
lib/device/dev-type.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
index 9278b51..e9106a9 100644
--- a/lib/device/dev-type.c
+++ b/lib/device/dev-type.c
@@ -1138,6 +1138,9 @@ int udev_dev_is_mpath_component(struct device *dev)
const char *value;
int ret = 0;
+ if (!obtain_device_list_from_udev())
+ return 0;
+
if (!(udev_device = _udev_get_dev(dev)))
return 0;
@@ -1167,6 +1170,9 @@ int udev_dev_is_md_component(struct device *dev)
const char *value;
int ret = 0;
+ if (!obtain_device_list_from_udev())
+ return 0;
+
if (!(udev_device = _udev_get_dev(dev)))
return 0;
5 years, 3 months