1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

hints: exclude md components

In some cases md components could be included in
the hints, so add a check to hint creation to make
sure they are excluded.
This commit is contained in:
David Teigland 2019-05-21 11:58:01 -05:00
parent 6422b9ddc5
commit 60bf9c9f33
4 changed files with 16 additions and 3 deletions

View File

@ -216,14 +216,20 @@ int dev_is_md_component(struct device *dev, uint64_t *offset_found, int full)
if (!full) { if (!full) {
if (!ret || (ret == -EAGAIN)) { if (!ret || (ret == -EAGAIN)) {
if (udev_dev_is_md_component(dev)) if (udev_dev_is_md_component(dev))
return 1; ret = 1;
} }
} }
if (ret && (ret != -EAGAIN))
dev->flags |= DEV_IS_MD_COMPONENT;
return ret; return ret;
} }
if (dev->ext.src == DEV_EXT_UDEV) if (dev->ext.src == DEV_EXT_UDEV) {
return _udev_dev_is_md_component(dev); 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 " log_error(INTERNAL_ERROR "Missing hook for MD device recognition "
"using external device info source %s", dev_ext_name(dev)); "using external device info source %s", dev_ext_name(dev));

View 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)) { 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\").", 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_name(dev), DEV_EXT_UDEV_BLKID_TYPE, value);
dev->flags |= DEV_IS_MD_COMPONENT;
ret = 1; ret = 1;
goto out; goto out;
} }

View File

@ -36,6 +36,7 @@
#define DEV_FILTER_OUT_SCAN 0x00004000 /* filtered out during label scan */ #define DEV_FILTER_OUT_SCAN 0x00004000 /* filtered out during label scan */
#define DEV_BCACHE_WRITE 0x00008000 /* bcache_fd is open with RDWR */ #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_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. * Support for external device info.

View File

@ -901,6 +901,11 @@ int write_hint_file(struct cmd_context *cmd, int newhints)
if (!(dev->flags & DEV_SCAN_FOUND_LABEL)) if (!(dev->flags & DEV_SCAN_FOUND_LABEL))
continue; 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, * No vgname will be found here for a PV with no mdas,
* in which case the vgname hint will be incomplete. * in which case the vgname hint will be incomplete.