]> sourceware.org Git - lvm2.git/commitdiff
hints: exclude md components
authorDavid Teigland <teigland@redhat.com>
Tue, 21 May 2019 16:58:01 +0000 (11:58 -0500)
committerDavid Teigland <teigland@redhat.com>
Tue, 21 May 2019 16:58:01 +0000 (11:58 -0500)
In some cases md components could be included in
the hints, so add a check to hint creation to make
sure they are excluded.

lib/device/dev-md.c
lib/device/dev-type.c
lib/device/device.h
lib/label/hints.c

index ab9320674c62dc390b3e29762e3be5b9a18a9f21..261f3f1e2c2ff9e494807c58b6003f2e7feeb502 100644 (file)
@@ -216,14 +216,20 @@ int dev_is_md_component(struct device *dev, uint64_t *offset_found, int full)
                if (!full) {
                        if (!ret || (ret == -EAGAIN)) {
                                if (udev_dev_is_md_component(dev))
-                                       return 1;
+                                       ret = 1;
                        }
                }
+               if (ret && (ret != -EAGAIN))
+                       dev->flags |= DEV_IS_MD_COMPONENT;
                return ret;
        }
 
-       if (dev->ext.src == DEV_EXT_UDEV)
-               return _udev_dev_is_md_component(dev);
+       if (dev->ext.src == DEV_EXT_UDEV) {
+               ret = _udev_dev_is_md_component(dev);
+               if (ret && (ret != -EAGAIN))
+                       dev->flags |= DEV_IS_MD_COMPONENT;
+               return ret;
+       }
 
        log_error(INTERNAL_ERROR "Missing hook for MD device recognition "
                  "using external device info source %s", dev_ext_name(dev));
index f0faa3d8c2431306ee191ea8f50f950bad4da7dc..73e55cabc96a1d4142295a40bff52bc7a06c1625 100644 (file)
@@ -1180,6 +1180,7 @@ int udev_dev_is_md_component(struct device *dev)
        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);
+               dev->flags |= DEV_IS_MD_COMPONENT;
                ret = 1;
                goto out;
        }
index afeee7f562112af42073146b586cb2708a4319f9..395405ab34e4dedb67d51b4da4ae08449e7dc1c6 100644 (file)
@@ -36,6 +36,7 @@
 #define DEV_FILTER_OUT_SCAN    0x00004000      /* filtered out during label scan */
 #define DEV_BCACHE_WRITE       0x00008000      /* bcache_fd is open with RDWR */
 #define DEV_SCAN_FOUND_LABEL   0x00010000      /* label scan read dev and found label */
+#define DEV_IS_MD_COMPONENT    0x00020000      /* device is an md component */
 
 /*
  * Support for external device info.
index 00bfbe3b780f1398a4de39301e680009d6ae7c9f..72dc91ee6537531f9adbd00f81a8c6ba97c9caa4 100644 (file)
@@ -901,6 +901,11 @@ int write_hint_file(struct cmd_context *cmd, int newhints)
                if (!(dev->flags & DEV_SCAN_FOUND_LABEL))
                        continue;
 
+               if (dev->flags & DEV_IS_MD_COMPONENT) {
+                       log_debug("exclude md component from hints %s", dev_name(dev));
+                       continue;
+               }
+
                /*
                 * No vgname will be found here for a PV with no mdas,
                 * in which case the vgname hint will be incomplete.
This page took 0.04159 seconds and 5 git commands to generate.