]> sourceware.org Git - lvm2.git/commitdiff
label: avoid rescaning unusable DM devices
authorZdenek Kabelac <zkabelac@redhat.com>
Tue, 9 Feb 2021 23:43:40 +0000 (00:43 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Wed, 10 Feb 2021 14:39:03 +0000 (15:39 +0100)
lib/label/label.c

index 1e777d7c2f32c86c163ef84ae4f57015c7791b39..030d2c578d6c21722c10fc21265fe0365774984f 100644 (file)
@@ -707,6 +707,19 @@ 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));
This page took 0.033675 seconds and 5 git commands to generate.