Skip to contentSkip to conversation

master - devs: use udev info to improve md component detection

PATCH David Teigland 1 participant 1 message Dec 3, 2018

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a063d2d123c56c4ccead986625a260df16556b9f
Commit:        a063d2d123c56c4ccead986625a260df16556b9f
Parent:        5a5e3bcf153eddc6a03554e26f6f8d795fead96e
Author:        David Teigland <[email protected]>
AuthorDate:    Mon Dec 3 11:22:45 2018 -0600
Committer:     David Teigland <[email protected]>
CommitterDate: Mon Dec 3 12:58:28 2018 -0600

devs: use udev info to improve md component detection

Use udev info to supplement native md component detection.

---
 lib/device/dev-md.c     |   14 +++++++++-
 lib/device/dev-type.c   |   62 +++++++++++++++++++++++++++++++++++++---------
 lib/device/dev-type.h   |    1 +
 lib/filters/filter-md.c |    1 +
 4 files changed, 64 insertions(+), 14 deletions(-)
lib/device/dev-md.c +12 -2
index 9c626dd..15e1280 100644
@@ -190,14 +190,24 @@ out:
 
 int dev_is_md(struct device *dev, uint64_t *offset_found, int full)
 {
+	int ret;
 
 	/*
 	 * If non-native device status source is selected, use it
 	 * only if offset_found is not requested as this
 	 * information is not in udev db.
 	 */
-	if ((dev->ext.src == DEV_EXT_NONE) || offset_found)
-		return _native_dev_is_md(dev, offset_found, full);
+	if ((dev->ext.src == DEV_EXT_NONE) || offset_found) {
+		ret = _native_dev_is_md(dev, offset_found, full);
+
+		if (!full) {
+			if (!ret || (ret == -EAGAIN)) {
+				if (udev_dev_is_md_component(dev))
+					return 1;
+			}
+		}
+		return ret;
+	}
 
 	if (dev->ext.src == DEV_EXT_UDEV)
 		return _udev_dev_is_md(dev);
lib/device/dev-type.c +50 -12

111 lines not on this page · raw message

lib/device/dev-type.h +1 -0
index e8f0fcb..75539e8 100644
@@ -62,6 +62,7 @@ int dev_is_swap(struct device *dev, uint64_t *signature, int full);
 int dev_is_luks(struct device *dev, uint64_t *signature, int full);
 int dasd_is_cdl_formatted(struct device *dev);
 int udev_dev_is_mpath_component(struct device *dev);
+int udev_dev_is_md_component(struct device *dev);
 
 int dev_is_lvm1(struct device *dev, char *buf, int buflen);
 int dev_is_pool(struct device *dev, char *buf, int buflen);
lib/filters/filter-md.c +1 -0
index 0275923..9cc1a06 100644
@@ -106,6 +106,7 @@ static int _passes_md_filter(struct cmd_context *cmd, struct dev_filter *f __att
 		return 1;
 
 	if (ret == 1) {
+		log_debug_devs("md filter full %d excluding md component %s", cmd->use_full_md_check, dev_name(dev));
 		if (dev->ext.src == DEV_EXT_NONE)
 			log_debug_devs(MSG_SKIPPING, dev_name(dev));
 		else