master - tests: lvm-on-md udev issues
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=73687b7b75c4f12b6f2...
Commit: 73687b7b75c4f12b6f21ba829898b4d13422db1c
Parent: 752b1e95f4f12225e6ed9302f078b3545e758549
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Dec 5 12:14:17 2018 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Dec 5 12:14:17 2018 -0600
tests: lvm-on-md udev issues
---
test/shell/lvm-on-md.sh | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvm-on-md.sh b/test/shell/lvm-on-md.sh
index a3e83d9..4f4a0c4 100644
--- a/test/shell/lvm-on-md.sh
+++ b/test/shell/lvm-on-md.sh
@@ -85,5 +85,8 @@ cat out
not grep "prefers device" out
vgchange -an $vg
+aux udev_wait
+
+aux cleanup_md_dev
-vgremove -f $vg
+# vgremove -f $vg
5 years, 5 months
master - man lvmlockd: lvextend with gfs2
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=752b1e95f4f12225e6e...
Commit: 752b1e95f4f12225e6ed9302f078b3545e758549
Parent: 3d2fd95af78c6f8a34c2d602285bd2230d89b3fd
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Dec 5 11:31:58 2018 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Dec 5 11:31:58 2018 -0600
man lvmlockd: lvextend with gfs2
---
man/lvmlockd.8_main | 33 ++++++++++++++++++++++++++-------
1 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/man/lvmlockd.8_main b/man/lvmlockd.8_main
index ebf57da..50b3473 100644
--- a/man/lvmlockd.8_main
+++ b/man/lvmlockd.8_main
@@ -773,6 +773,28 @@ vgchange --lock-type none --lock-opt force <vgname>
After the VG is local, follow the steps described in "changing a local VG
to a shared VG".
+.SS extending an LV active on multiple hosts
+
+With lvmlockd, a new procedure is required to extend an LV while it is
+active on multiple hosts (e.g. when used under gfs2):
+
+1. On one node run the lvextend command:
+.br
+.nf
+ lvextend --lockopt skiplv -L Size VG/LV
+.fi
+
+2. On each node using the LV, refresh the LV:
+.br
+.nf
+ lvchange --refresh VG/LV
+.fi
+
+3. On one node extend gfs2 (or comparable for other applications):
+.br
+.nf
+ gfs2_grow VG/LV
+.fi
.SS limitations of shared VGs
@@ -806,12 +828,12 @@ Visible usage differences between shared VGs (using lvmlockd) and
clvm/clustered VGs (using clvmd):
.IP \[bu] 2
-lvm.conf must be configured to use either lvmlockd (use_lvmlockd=1) or
-clvmd (locking_type=3), but not both.
+lvm.conf is configured to use lvmlockd by setting use_lvmlockd=1.
+clvmd used locking_type=3.
.IP \[bu] 2
-vgcreate --shared creates a shared VG, and vgcreate --clustered y
-creates a clvm/clustered VG.
+vgcreate --shared creates a shared VG. vgcreate --clustered y
+created a clvm/clustered VG.
.IP \[bu] 2
lvmlockd adds the option of using sanlock for locking, avoiding the
@@ -826,9 +848,6 @@ lvmlockd commands always apply to the local host, and never have an effect
on a remote host. (The activation option 'l' is not used.)
.IP \[bu] 2
-lvmlockd works with thin and cache pools and LVs.
-
-.IP \[bu] 2
lvmlockd saves the cluster name for a shared VG using dlm. Only hosts in
the matching cluster can use the VG.
5 years, 5 months
master - remove unused full filter
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3d2fd95af78c6f8a34c...
Commit: 3d2fd95af78c6f8a34c2d602285bd2230d89b3fd
Parent: 89c11a2b49182f6858629857b8c6b3ba126c5970
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Dec 4 14:06:46 2018 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Dec 4 14:06:46 2018 -0600
remove unused full filter
it's the same as cmd->filter
---
lib/cache/lvmcache.c | 4 ++--
lib/commands/toolcontext.c | 10 ++++------
lib/commands/toolcontext.h | 3 +--
lib/label/label.c | 4 ++--
tools/lvmdiskscan.c | 4 ++--
tools/pvscan.c | 12 ++++++------
tools/reporter.c | 2 +-
tools/toollib.c | 8 ++++----
8 files changed, 22 insertions(+), 25 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index d35b366..da8b4d8 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -857,8 +857,8 @@ int lvmcache_label_scan(struct cmd_context *cmd)
_scanning_in_progress = 1;
/* FIXME: can this happen? */
- if (!cmd->full_filter) {
- log_error("label scan is missing full filter");
+ if (!cmd->filter) {
+ log_error("label scan is missing filter");
goto out;
}
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 8b2ab4e..c42ed56 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -1181,9 +1181,7 @@ int init_filters(struct cmd_context *cmd, unsigned load_persistent_cache)
goto bad;
}
- cmd->filter = filter = pfilter;
-
- cmd->full_filter = filter;
+ cmd->filter = pfilter;
cmd->initialized.filters = 1;
return 1;
@@ -1834,9 +1832,9 @@ static void _destroy_dev_types(struct cmd_context *cmd)
static void _destroy_filters(struct cmd_context *cmd)
{
- if (cmd->full_filter) {
- cmd->full_filter->destroy(cmd->full_filter);
- cmd->filter = cmd->full_filter = NULL;
+ if (cmd->filter) {
+ cmd->filter->destroy(cmd->filter);
+ cmd->filter = NULL;
}
cmd->initialized.filters = 0;
}
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index f820ba1..6396f6c 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -176,8 +176,7 @@ struct cmd_context {
/*
* Filtering.
*/
- struct dev_filter *filter; /* post-lvmetad filter chain */
- struct dev_filter *full_filter; /* lvmetad_filter + filter */
+ struct dev_filter *filter;
/*
* Configuration.
diff --git a/lib/label/label.c b/lib/label/label.c
index 1fb374e..0517312 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -855,7 +855,7 @@ int label_scan(struct cmd_context *cmd)
*/
dev_cache_scan();
- if (!(iter = dev_iter_create(cmd->full_filter, 0))) {
+ if (!(iter = dev_iter_create(cmd->filter, 0))) {
log_error("Scanning failed to get devices.");
return 0;
}
@@ -898,7 +898,7 @@ int label_scan(struct cmd_context *cmd)
return 0;
}
- _scan_list(cmd, cmd->full_filter, &all_devs, NULL);
+ _scan_list(cmd, cmd->filter, &all_devs, NULL);
dm_list_iterate_items_safe(devl, devl2, &all_devs) {
dm_list_del(&devl->list);
diff --git a/tools/lvmdiskscan.c b/tools/lvmdiskscan.c
index 0b97eba..a504c3a 100644
--- a/tools/lvmdiskscan.c
+++ b/tools/lvmdiskscan.c
@@ -100,9 +100,9 @@ int lvmdiskscan(struct cmd_context *cmd, int argc __attribute__((unused)),
/* Call before using dev_iter which uses filters which want bcache data. */
label_scan(cmd);
- max_len = _get_max_dev_name_len(cmd, cmd->full_filter);
+ max_len = _get_max_dev_name_len(cmd, cmd->filter);
- if (!(iter = dev_iter_create(cmd->full_filter, 0))) {
+ if (!(iter = dev_iter_create(cmd->filter, 0))) {
log_error("dev_iter_create failed");
return ECMD_FAILED;
}
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 884a824..2a884df 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -539,7 +539,7 @@ static void _online_pvscan_all_devs(struct cmd_context *cmd,
label_scan(cmd);
- if (!(iter = dev_iter_create(cmd->full_filter, 1))) {
+ if (!(iter = dev_iter_create(cmd->filter, 1))) {
log_error("dev_iter creation failed");
return;
}
@@ -680,7 +680,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
while (argc--) {
pv_name = *argv++;
if (pv_name[0] == '/') {
- if (!(dev = dev_cache_get(cmd, pv_name, cmd->full_filter))) {
+ if (!(dev = dev_cache_get(cmd, pv_name, cmd->filter))) {
log_debug("pvscan arg %s not found.", pv_name);
if ((dev = dev_cache_get(cmd, pv_name, NULL))) {
/* nothing to do for this dev name */
@@ -707,7 +707,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
}
devno = MKDEV(major, minor);
- if (!(dev = dev_cache_get_by_devt(cmd, devno, cmd->full_filter))) {
+ if (!(dev = dev_cache_get_by_devt(cmd, devno, cmd->filter))) {
log_debug("pvscan arg %d:%d not found.", major, minor);
_online_pvid_file_remove_devno(major, minor);
} else {
@@ -731,7 +731,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
}
if (!dm_list_empty(&single_devs)) {
- label_scan_devs(cmd, cmd->full_filter, &single_devs);
+ label_scan_devs(cmd, cmd->filter, &single_devs);
dm_list_iterate_items(devl, &single_devs) {
dev = devl->dev;
@@ -763,7 +763,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
devno = MKDEV(major, minor);
- if (!(dev = dev_cache_get_by_devt(cmd, devno, cmd->full_filter))) {
+ if (!(dev = dev_cache_get_by_devt(cmd, devno, cmd->filter))) {
log_debug("pvscan arg %d:%d not found.", major, minor);
_online_pvid_file_remove_devno(major, minor);
} else {
@@ -782,7 +782,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
}
if (!dm_list_empty(&single_devs)) {
- label_scan_devs(cmd, cmd->full_filter, &single_devs);
+ label_scan_devs(cmd, cmd->filter, &single_devs);
dm_list_iterate_items(devl, &single_devs) {
dev = devl->dev;
diff --git a/tools/reporter.c b/tools/reporter.c
index cd2a41e..c321d21 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -719,7 +719,7 @@ static void _check_pv_list(struct cmd_context *cmd, struct report_args *args, st
if (single_args->args_are_pvs && args->argc) {
for (i = 0; i < args->argc; i++) {
- if (!rescan_done && !dev_cache_get(cmd, args->argv[i], cmd->full_filter)) {
+ if (!rescan_done && !dev_cache_get(cmd, args->argv[i], cmd->filter)) {
cmd->filter->wipe(cmd->filter);
/* FIXME scan only one device */
lvmcache_label_scan(cmd);
diff --git a/tools/toollib.c b/tools/toollib.c
index 6c38eb2..d8394a3 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1477,7 +1477,7 @@ int process_each_label(struct cmd_context *cmd, int argc, char **argv,
if (argc) {
for (; opt < argc; opt++) {
- if (!(dev = dev_cache_get(cmd, argv[opt], cmd->full_filter))) {
+ if (!(dev = dev_cache_get(cmd, argv[opt], cmd->filter))) {
log_error("Failed to find device "
"\"%s\".", argv[opt]);
ret_max = ECMD_FAILED;
@@ -1548,7 +1548,7 @@ int process_each_label(struct cmd_context *cmd, int argc, char **argv,
goto out;
}
- if (!(iter = dev_iter_create(cmd->full_filter, 1))) {
+ if (!(iter = dev_iter_create(cmd->filter, 1))) {
log_error("dev_iter creation failed.");
ret_max = ECMD_FAILED;
goto out;
@@ -3917,7 +3917,7 @@ static int _get_all_devices(struct cmd_context *cmd, struct dm_list *all_devices
log_debug("Getting list of all devices");
- if (!(iter = dev_iter_create(cmd->full_filter, 1))) {
+ if (!(iter = dev_iter_create(cmd->filter, 1))) {
log_error("dev_iter creation failed.");
return ECMD_FAILED;
}
@@ -5424,7 +5424,7 @@ int pvcreate_each_device(struct cmd_context *cmd,
* Translate arg names into struct device's.
*/
dm_list_iterate_items(pd, &pp->arg_devices)
- pd->dev = dev_cache_get(cmd, pd->name, cmd->full_filter);
+ pd->dev = dev_cache_get(cmd, pd->name, cmd->filter);
/*
* Use process_each_pv to search all existing PVs and devices.
5 years, 5 months
master - remove unused lvmetad filter
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=89c11a2b49182f68586...
Commit: 89c11a2b49182f6858629857b8c6b3ba126c5970
Parent: c1b2de936cf231c753c4c9f325d33ad5c746709e
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Dec 4 12:44:43 2018 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Dec 4 12:44:43 2018 -0600
remove unused lvmetad filter
---
lib/commands/toolcontext.c | 54 +++++++++++++-------------------------------
lib/commands/toolcontext.h | 1 -
2 files changed, 16 insertions(+), 39 deletions(-)
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 754be86..8b2ab4e 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -1034,7 +1034,7 @@ static int _init_dev_cache(struct cmd_context *cmd)
#define MAX_FILTERS 10
-static struct dev_filter *_init_lvmetad_filter_chain(struct cmd_context *cmd)
+static struct dev_filter *_init_filter_chain(struct cmd_context *cmd)
{
int nr_filt = 0;
const struct dm_config_node *cn;
@@ -1143,27 +1143,9 @@ bad:
}
/*
- * The way the filtering is initialized depends on whether lvmetad is uesd or not.
- *
- * If lvmetad is used, there are three filter chains:
- *
- * - cmd->lvmetad_filter - the lvmetad filter chain used when scanning devs for lvmetad update:
- * sysfs filter -> internal filter -> global regex filter -> type filter ->
- * usable device filter(FILTER_MODE_PRE_LVMETAD) ->
- * mpath component filter -> partitioned filter ->
- * md component filter -> fw raid filter
- *
- * - cmd->filter - the filter chain used for lvmetad responses:
- * persistent filter -> regex_filter -> usable device filter(FILTER_MODE_POST_LVMETAD)
- *
- * - cmd->full_filter - the filter chain used for all the remaining situations:
- * cmd->lvmetad_filter -> cmd->filter
- *
- * If lvmetad is not used, there's just one filter chain:
- *
- * - cmd->filter == cmd->full_filter:
- * persistent filter -> sysfs filter -> internal filter -> global regex filter ->
- * regex_filter -> type filter -> usable device filter(FILTER_MODE_NO_LVMETAD) ->
+ * cmd->filter ==
+ * persistent(cache) filter -> sysfs filter -> internal filter -> global regex filter ->
+ * regex_filter -> type filter -> usable device filter ->
* mpath component filter -> partitioned filter -> md component filter -> fw raid filter
*
*/
@@ -1176,24 +1158,24 @@ int init_filters(struct cmd_context *cmd, unsigned load_persistent_cache)
return 0;
}
- cmd->lvmetad_filter = _init_lvmetad_filter_chain(cmd);
- if (!cmd->lvmetad_filter)
+ filter = _init_filter_chain(cmd);
+ if (!filter)
goto_bad;
init_ignore_suspended_devices(find_config_tree_bool(cmd, devices_ignore_suspended_devices_CFG, NULL));
init_ignore_lvm_mirrors(find_config_tree_bool(cmd, devices_ignore_lvm_mirrors_CFG, NULL));
/*
- * If lvmetad is used, there's a separation between pre-lvmetad filter chain
- * ("cmd->lvmetad_filter") applied only if scanning for lvmetad update and
- * post-lvmetad filter chain ("filter") applied on each lvmetad response.
- * However, if lvmetad is not used, these two chains are not separated
- * and we use exactly one filter chain during device scanning ("filter"
- * that includes also "cmd->lvmetad_filter" chain).
+ * persisent filter is a cache of the previous result real filter result.
+ * If a dev is found in persistent filter, the pass/fail result saved by
+ * the pfilter is used. If a dev does not existing in the persistent
+ * filter, the dev is passed on to the real filter, and when the result
+ * of the real filter is saved in the persistent filter.
+ *
+ * FIXME: we should apply the filter once at the start of the command,
+ * and not call the filters repeatedly. In that case we would not need
+ * the persistent/caching filter layer.
*/
- filter = cmd->lvmetad_filter;
- cmd->lvmetad_filter = NULL;
-
if (!(pfilter = persistent_filter_create(cmd->dev_types, filter))) {
log_verbose("Failed to create persistent device filter.");
goto bad;
@@ -1223,10 +1205,6 @@ bad:
filter->destroy(filter);
}
- /* if lvmetad is used, the cmd->lvmetad_filter is separate */
- if (cmd->lvmetad_filter)
- cmd->lvmetad_filter->destroy(cmd->lvmetad_filter);
-
cmd->initialized.filters = 0;
return 0;
}
@@ -1858,7 +1836,7 @@ static void _destroy_filters(struct cmd_context *cmd)
{
if (cmd->full_filter) {
cmd->full_filter->destroy(cmd->full_filter);
- cmd->lvmetad_filter = cmd->filter = cmd->full_filter = NULL;
+ cmd->filter = cmd->full_filter = NULL;
}
cmd->initialized.filters = 0;
}
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index 2ac7a1e..f820ba1 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -176,7 +176,6 @@ struct cmd_context {
/*
* Filtering.
*/
- struct dev_filter *lvmetad_filter; /* pre-lvmetad filter chain */
struct dev_filter *filter; /* post-lvmetad filter chain */
struct dev_filter *full_filter; /* lvmetad_filter + filter */
5 years, 5 months
master - pvscan: use correct dev filters
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c1b2de936cf231c753c...
Commit: c1b2de936cf231c753c4c9f325d33ad5c746709e
Parent: a063d2d123c56c4ccead986625a260df16556b9f
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Dec 3 12:58:46 2018 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Dec 3 12:58:46 2018 -0600
pvscan: use correct dev filters
pvscan was still using lvmetad_filter which has been
null since lvmetad was removed. Switch it to use the
full_filter.
---
tools/pvscan.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 0f7603e..884a824 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -539,7 +539,7 @@ static void _online_pvscan_all_devs(struct cmd_context *cmd,
label_scan(cmd);
- if (!(iter = dev_iter_create(cmd->lvmetad_filter, 1))) {
+ if (!(iter = dev_iter_create(cmd->full_filter, 1))) {
log_error("dev_iter creation failed");
return;
}
@@ -680,7 +680,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
while (argc--) {
pv_name = *argv++;
if (pv_name[0] == '/') {
- if (!(dev = dev_cache_get(cmd, pv_name, cmd->lvmetad_filter))) {
+ if (!(dev = dev_cache_get(cmd, pv_name, cmd->full_filter))) {
log_debug("pvscan arg %s not found.", pv_name);
if ((dev = dev_cache_get(cmd, pv_name, NULL))) {
/* nothing to do for this dev name */
@@ -707,7 +707,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
}
devno = MKDEV(major, minor);
- if (!(dev = dev_cache_get_by_devt(cmd, devno, cmd->lvmetad_filter))) {
+ if (!(dev = dev_cache_get_by_devt(cmd, devno, cmd->full_filter))) {
log_debug("pvscan arg %d:%d not found.", major, minor);
_online_pvid_file_remove_devno(major, minor);
} else {
@@ -731,7 +731,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
}
if (!dm_list_empty(&single_devs)) {
- label_scan_devs(cmd, cmd->lvmetad_filter, &single_devs);
+ label_scan_devs(cmd, cmd->full_filter, &single_devs);
dm_list_iterate_items(devl, &single_devs) {
dev = devl->dev;
@@ -763,7 +763,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
devno = MKDEV(major, minor);
- if (!(dev = dev_cache_get_by_devt(cmd, devno, cmd->lvmetad_filter))) {
+ if (!(dev = dev_cache_get_by_devt(cmd, devno, cmd->full_filter))) {
log_debug("pvscan arg %d:%d not found.", major, minor);
_online_pvid_file_remove_devno(major, minor);
} else {
@@ -782,7 +782,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
}
if (!dm_list_empty(&single_devs)) {
- label_scan_devs(cmd, cmd->lvmetad_filter, &single_devs);
+ label_scan_devs(cmd, cmd->full_filter, &single_devs);
dm_list_iterate_items(devl, &single_devs) {
dev = devl->dev;
5 years, 5 months
master - devs: use udev info to improve md component detection
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a063d2d123c56c4ccea...
Commit: a063d2d123c56c4ccead986625a260df16556b9f
Parent: 5a5e3bcf153eddc6a03554e26f6f8d795fead96e
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Dec 3 11:22:45 2018 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Dec 3 12:58:28 2018 -0600
devs: use udev info to improve md component detection
Use udev info to supplement native md component detection.
---
lib/device/dev-md.c | 14 +++++++++-
lib/device/dev-type.c | 62 +++++++++++++++++++++++++++++++++++++---------
lib/device/dev-type.h | 1 +
lib/filters/filter-md.c | 1 +
4 files changed, 64 insertions(+), 14 deletions(-)
diff --git a/lib/device/dev-md.c b/lib/device/dev-md.c
index 9c626dd..15e1280 100644
--- a/lib/device/dev-md.c
+++ b/lib/device/dev-md.c
@@ -190,14 +190,24 @@ out:
int dev_is_md(struct device *dev, uint64_t *offset_found, int full)
{
+ int ret;
/*
* If non-native device status source is selected, use it
* only if offset_found is not requested as this
* information is not in udev db.
*/
- if ((dev->ext.src == DEV_EXT_NONE) || offset_found)
- return _native_dev_is_md(dev, offset_found, full);
+ if ((dev->ext.src == DEV_EXT_NONE) || offset_found) {
+ ret = _native_dev_is_md(dev, offset_found, full);
+
+ if (!full) {
+ if (!ret || (ret == -EAGAIN)) {
+ if (udev_dev_is_md_component(dev))
+ return 1;
+ }
+ }
+ return ret;
+ }
if (dev->ext.src == DEV_EXT_UDEV)
return _udev_dev_is_md(dev);
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
index 1f74fdc..693550a 100644
--- a/lib/device/dev-type.c
+++ b/lib/device/dev-type.c
@@ -1047,25 +1047,23 @@ int dev_is_rotational(struct dev_types *dt, struct device *dev)
* failed already due to timeout in udev - in both cases the
* udev_device_get_is_initialized returns 0.
*/
-#define UDEV_DEV_IS_MPATH_COMPONENT_ITERATION_COUNT 100
-#define UDEV_DEV_IS_MPATH_COMPONENT_USLEEP 100000
+#define UDEV_DEV_IS_COMPONENT_ITERATION_COUNT 100
+#define UDEV_DEV_IS_COMPONENT_USLEEP 100000
-int udev_dev_is_mpath_component(struct device *dev)
+static struct udev_device *_udev_get_dev(struct device *dev)
{
struct udev *udev_context = udev_get_library_context();
struct udev_device *udev_device = NULL;
- const char *value;
int initialized = 0;
unsigned i = 0;
- int ret = 0;
if (!udev_context) {
log_warn("WARNING: No udev context available to check if device %s is multipath component.", dev_name(dev));
- return 0;
+ return NULL;
}
while (1) {
- if (i >= UDEV_DEV_IS_MPATH_COMPONENT_ITERATION_COUNT)
+ if (i >= UDEV_DEV_IS_COMPONENT_ITERATION_COUNT)
break;
if (udev_device)
@@ -1073,7 +1071,7 @@ int udev_dev_is_mpath_component(struct device *dev)
if (!(udev_device = udev_device_new_from_devnum(udev_context, 'b', dev->dev))) {
log_warn("WARNING: Failed to get udev device handler for device %s.", dev_name(dev));
- return 0;
+ return NULL;
}
#ifdef HAVE_LIBUDEV_UDEV_DEVICE_GET_IS_INITIALIZED
@@ -1085,19 +1083,32 @@ int udev_dev_is_mpath_component(struct device *dev)
#endif
log_debug("Device %s not initialized in udev database (%u/%u, %u microseconds).", dev_name(dev),
- i + 1, UDEV_DEV_IS_MPATH_COMPONENT_ITERATION_COUNT,
- i * UDEV_DEV_IS_MPATH_COMPONENT_USLEEP);
+ i + 1, UDEV_DEV_IS_COMPONENT_ITERATION_COUNT,
+ i * UDEV_DEV_IS_COMPONENT_USLEEP);
- usleep(UDEV_DEV_IS_MPATH_COMPONENT_USLEEP);
+ usleep(UDEV_DEV_IS_COMPONENT_USLEEP);
i++;
}
if (!initialized) {
log_warn("WARNING: Device %s not initialized in udev database even after waiting %u microseconds.",
- dev_name(dev), i * UDEV_DEV_IS_MPATH_COMPONENT_USLEEP);
+ dev_name(dev), i * UDEV_DEV_IS_COMPONENT_USLEEP);
goto out;
}
+out:
+ return udev_device;
+}
+
+int udev_dev_is_mpath_component(struct device *dev)
+{
+ struct udev_device *udev_device;
+ const char *value;
+ int ret = 0;
+
+ if (!(udev_device = _udev_get_dev(dev)))
+ return 0;
+
value = udev_device_get_property_value(udev_device, DEV_EXT_UDEV_BLKID_TYPE);
if (value && !strcmp(value, DEV_EXT_UDEV_BLKID_TYPE_MPATH)) {
log_debug("Device %s is multipath component based on blkid variable in udev db (%s=\"%s\").",
@@ -1117,6 +1128,28 @@ out:
udev_device_unref(udev_device);
return ret;
}
+
+int udev_dev_is_md_component(struct device *dev)
+{
+ struct udev_device *udev_device;
+ const char *value;
+ int ret = 0;
+
+ if (!(udev_device = _udev_get_dev(dev)))
+ return 0;
+
+ value = udev_device_get_property_value(udev_device, DEV_EXT_UDEV_BLKID_TYPE);
+ if (value && !strcmp(value, DEV_EXT_UDEV_BLKID_TYPE_SW_RAID)) {
+ log_debug("Device %s is md raid component based on blkid variable in udev db (%s=\"%s\").",
+ dev_name(dev), DEV_EXT_UDEV_BLKID_TYPE, value);
+ ret = 1;
+ goto out;
+ }
+out:
+ udev_device_unref(udev_device);
+ return ret;
+}
+
#else
int udev_dev_is_mpath_component(struct device *dev)
@@ -1124,4 +1157,9 @@ int udev_dev_is_mpath_component(struct device *dev)
return 0;
}
+int udev_dev_is_md_component(struct device *dev)
+{
+ return 0;
+}
+
#endif
diff --git a/lib/device/dev-type.h b/lib/device/dev-type.h
index e8f0fcb..75539e8 100644
--- a/lib/device/dev-type.h
+++ b/lib/device/dev-type.h
@@ -62,6 +62,7 @@ int dev_is_swap(struct device *dev, uint64_t *signature, int full);
int dev_is_luks(struct device *dev, uint64_t *signature, int full);
int dasd_is_cdl_formatted(struct device *dev);
int udev_dev_is_mpath_component(struct device *dev);
+int udev_dev_is_md_component(struct device *dev);
int dev_is_lvm1(struct device *dev, char *buf, int buflen);
int dev_is_pool(struct device *dev, char *buf, int buflen);
diff --git a/lib/filters/filter-md.c b/lib/filters/filter-md.c
index 0275923..9cc1a06 100644
--- a/lib/filters/filter-md.c
+++ b/lib/filters/filter-md.c
@@ -106,6 +106,7 @@ static int _passes_md_filter(struct cmd_context *cmd, struct dev_filter *f __att
return 1;
if (ret == 1) {
+ log_debug_devs("md filter full %d excluding md component %s", cmd->use_full_md_check, dev_name(dev));
if (dev->ext.src == DEV_EXT_NONE)
log_debug_devs(MSG_SKIPPING, dev_name(dev));
else
5 years, 5 months
master - gcc: ensure sector is initilized
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5a5e3bcf153eddc6a03...
Commit: 5a5e3bcf153eddc6a03554e26f6f8d795fead96e
Parent: d8ad73e9377adea67819db083d66debc39dec993
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 30 22:26:26 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Dec 1 01:07:01 2018 +0100
gcc: ensure sector is initilized
Some older gcc errnously report the variable can be used uninitlized.
Quite warning by explicit initalization.
---
lib/label/label.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/label/label.c b/lib/label/label.c
index 82ebd71..1fb374e 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -356,7 +356,7 @@ static int _process_block(struct cmd_context *cmd, struct dev_filter *f,
char label_buf[LABEL_SIZE] __attribute__((aligned(8)));
struct label *label = NULL;
struct labeller *labeller;
- uint64_t sector;
+ uint64_t sector = 0;
int ret = 0;
int pass;
5 years, 5 months
master - gcc: avoid shadowing use_aio
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d8ad73e9377adea6781...
Commit: d8ad73e9377adea67819db083d66debc39dec993
Parent: 0d61a171520beeff0bf592458359d04257e2c780
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 30 21:56:16 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Dec 1 01:07:01 2018 +0100
gcc: avoid shadowing use_aio
Function use_aio() is already declared, avoid its shadowing.
lvm-globals.h:59: warning: shadowed declaration is here
---
lib/misc/lvm-globals.c | 4 ++--
lib/misc/lvm-globals.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/misc/lvm-globals.c b/lib/misc/lvm-globals.c
index 0ad60fd..9d169e7 100644
--- a/lib/misc/lvm-globals.c
+++ b/lib/misc/lvm-globals.c
@@ -70,9 +70,9 @@ void init_test(int level)
_test = level;
}
-void init_use_aio(int use_aio)
+void init_use_aio(int useaio)
{
- _use_aio = use_aio;
+ _use_aio = useaio;
}
void init_md_filtering(int level)
diff --git a/lib/misc/lvm-globals.h b/lib/misc/lvm-globals.h
index 42dcc34..793beca 100644
--- a/lib/misc/lvm-globals.h
+++ b/lib/misc/lvm-globals.h
@@ -25,7 +25,7 @@ enum dev_ext_e;
void init_verbose(int level);
void init_silent(int silent);
void init_test(int level);
-void init_use_aio(int use_aio);
+void init_use_aio(int useaio);
void init_md_filtering(int level);
void init_internal_filtering(int level);
void init_fwraid_filtering(int level);
5 years, 5 months
master - gcc: avoid shadowing activate_lv
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0d61a171520beeff0bf...
Commit: 0d61a171520beeff0bf592458359d04257e2c780
Parent: 1aac59f82ac021afe8a0a7aa6059e068637db9ba
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 30 21:50:41 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Dec 1 01:06:57 2018 +0100
gcc: avoid shadowing activate_lv
Function activate_lv() is already declared, avoid its shadowing.
activate.h:133: warning: shadowed declaration is here
---
lib/activate/activate.c | 8 ++++----
lib/activate/activate.h | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index b1f7391..ce9d67c 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -2476,19 +2476,19 @@ out:
/* Test if LV passes filter */
int lv_activation_filter(struct cmd_context *cmd, const char *lvid_s,
- int *activate_lv, const struct logical_volume *lv)
+ int *activate, const struct logical_volume *lv)
{
if (!activation()) {
- *activate_lv = 1;
+ *activate = 1;
return 1;
}
if (!_passes_activation_filter(cmd, lv)) {
log_verbose("Not activating %s since it does not pass "
"activation filter.", display_lvname(lv));
- *activate_lv = 0;
+ *activate = 0;
} else
- *activate_lv = 1;
+ *activate = 1;
return 1;
}
diff --git a/lib/activate/activate.h b/lib/activate/activate.h
index 8f9c918..aa5410c 100644
--- a/lib/activate/activate.h
+++ b/lib/activate/activate.h
@@ -162,10 +162,10 @@ int lv_info_with_seg_status(struct cmd_context *cmd,
int lv_check_not_in_use(const struct logical_volume *lv, int error_if_used);
/*
- * Returns 1 if activate_lv has been set: 1 = activate; 0 = don't.
+ * Returns 1 if activate has been set: 1 = activate; 0 = don't.
*/
int lv_activation_filter(struct cmd_context *cmd, const char *lvid_s,
- int *activate_lv, const struct logical_volume *lv);
+ int *activate, const struct logical_volume *lv);
/*
* Checks against the auto_activation_volume_list and
* returns 1 if the LV should be activated, 0 otherwise.
5 years, 5 months
master - gcc: avoid shadowing index
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1aac59f82ac021afe8a...
Commit: 1aac59f82ac021afe8a0a7aa6059e068637db9ba
Parent: 250e05a9656bf8888ac6e399791c46369e77d667
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 30 21:46:14 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Dec 1 01:06:51 2018 +0100
gcc: avoid shadowing index
Some older headers were declaring 'index' so avoid its usage.
/usr/include/string.h:489: warning: shadowed declaration is here
---
base/data-struct/radix-tree-adaptive.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/base/data-struct/radix-tree-adaptive.c b/base/data-struct/radix-tree-adaptive.c
index 25dfbee..5e065b6 100644
--- a/base/data-struct/radix-tree-adaptive.c
+++ b/base/data-struct/radix-tree-adaptive.c
@@ -624,15 +624,15 @@ static void _degrade_to_n48(struct node256 *n256, struct value *result)
}
// Removes an entry in an array by sliding the values above it down.
-static void _erase_elt(void *array, size_t obj_size, unsigned count, unsigned index)
+static void _erase_elt(void *array, size_t obj_size, unsigned count, unsigned idx)
{
- if (index == (count - 1))
+ if (idx == (count - 1))
// The simple case
return;
- memmove(((uint8_t *) array) + (obj_size * index),
- ((uint8_t *) array) + (obj_size * (index + 1)),
- obj_size * (count - index - 1));
+ memmove(((uint8_t *) array) + (obj_size * idx),
+ ((uint8_t *) array) + (obj_size * (idx + 1)),
+ obj_size * (count - idx - 1));
// Zero the now unused last elt (set's v.type to UNSET)
memset(((uint8_t *) array) + (count - 1) * obj_size, 0, obj_size);
5 years, 5 months