summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2021-02-10 14:06:58 -0600
committerDavid Teigland <teigland@redhat.com>2021-02-10 15:34:45 -0600
commitc94d78f068653293e42f0fe815ddeef98406c666 (patch)
tree34ef07e97bde2c8512cbf5388df62a23d9e2edf1
parentf49bedc0295d4b038004adfda64fafcfa8b1d2c7 (diff)
downloadlvm2-c94d78f068653293e42f0fe815ddeef98406c666.tar.gz
scan: wipe filters when dropping scanned data
Fix clearing persistent filter state when clearing all the state from a label_scan. label_scan reads devs and saves info in bcache, lvmcache, and in the persistent filter. In some uncommon cases, an lvm command wants to clear all info from a prior label_scan, and repeat label_scan from scratch. In these cases, info in lvmcache, bcache and the persistent filter all need to be cleared before repeating label_scan. By missing the persistent filter wiping, outdated persistent filter info, from a prior label_scan, could cause lvm to incorrectly filter devices that change between polling intervals. (i.e. if the device changes in such a way that the filtering results change.) A case where lvm wants to do multiple label_scans is a polling command (like lvconvert --merge), when lvmpolld has been disabled, so that the command itself needs to to do repeated polling checks.
-rw-r--r--lib/label/label.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/lib/label/label.c b/lib/label/label.c
index 030d2c578..0fc832c08 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -707,19 +707,6 @@ static int _scan_list(struct cmd_context *cmd, struct dev_filter *f,
if (!rem_prefetches)
break;
- /* FIXME: figure better solution to avoid opening DM we shouldn't open */
- if (dm_is_dm_major(MAJOR(devl->dev->dev)) &&
- !device_is_usable(devl->dev, (struct dev_usable_check_params) {
- .check_blocked = 1,
- .check_suspended = ignore_suspended_devices(),
- .check_reserved = 1,
- .check_error_target = 1,
- })) {
- log_debug_devs("Scan skips unusuable DM device %s.", dev_name(devl->dev));
- dm_list_del(&devl->list);
- continue;
- }
-
if (!_in_bcache(devl->dev)) {
if (!_scan_dev_open(devl->dev)) {
log_debug_devs("Scan failed to open %s.", dev_name(devl->dev));
@@ -1432,6 +1419,7 @@ void label_scan_drop(struct cmd_context *cmd)
return;
while ((dev = dev_iter_get(cmd, iter))) {
+ cmd->filter->wipe(cmd, cmd->filter, dev, NULL);
if (_in_bcache(dev))
_scan_dev_close(dev);
}