master - hints: exclude md components
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=60bf9c9f331fb0282b1ceca57148aad54cb943a0 Commit: 60bf9c9f331fb0282b1ceca57148aad54cb943a0 Parent: 6422b9ddc5c46968e2bef6ced12cd38e0b44c49d Author: David Teigland <[email protected]> AuthorDate: Tue May 21 11:58:01 2019 -0500 Committer: David Teigland <[email protected]> CommitterDate: Tue May 21 11:58:01 2019 -0500
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.
--- lib/device/dev-md.c | 12 +++++++++--- lib/device/dev-type.c | 1 + lib/device/device.h | 1 + lib/label/hints.c | 5 +++++ 4 files changed, 16 insertions(+), 3 deletions(-)
lib/device/dev-md.c +9 -3
@@ -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));
lib/device/dev-type.c +1 -0
@@ -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; }
lib/device/device.h +1 -0
@@ -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.
lib/label/hints.c +5 -0
@@ -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.