Skip to contentSkip to conversation

Skip also special lvm devices in scan (if ignore suspended is used).

PATCH New Milan Broz 2 participants 4 messages May 13, 2010

lore
Share & tools
lore

Milan Broz

author
#0 lore raw

PATCH 1/1 Skip also special lvm devices in scan (if ignore suspended is used).

This shoud avoid various races between dmeventd on multiple nodes in cluster where one node already repairing device and another run full scan and locks the device.

---
 lib/activate/dev_manager.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
lib/activate/dev_manager.c +7 -1
index d52d46f..ccafc1e 100644
@@ -130,7 +130,7 @@ int device_is_usable(dev_t dev)
 {
 	struct dm_task *dmt;
 	struct dm_info info;
-	const char *name;
+	const char *name, *uuid;
 	uint64_t start, length;
 	char *target_type = NULL;
 	char *params;
@@ -157,6 +157,7 @@ int device_is_usable(dev_t dev)
 		goto out;
 
 	name = dm_task_get_name(dmt);
+	uuid = dm_task_get_uuid(dmt);
 
 	/* FIXME Also check for mirror block_on_error and mpath no paths */
 	/* For now, we exclude all mirrors */
@@ -171,6 +172,11 @@ int device_is_usable(dev_t dev)
 
 	/* FIXME Also check dependencies? */
 
+	/* Check internal lvm devices */
+	if (!is_reserved_lvname(name) && uuid &&
+	    !strncmp(uuid, UUID_PREFIX, sizeof(UUID_PREFIX) - 1))
+		goto out;
+
 	r = 1;
 
       out:
Signature · 1 line
1.7.1
author
#1 lore raw

PATCH 1/1 Skip also special lvm devices in scan (if ignore suspended is used).

Quoted 31 lines · Milan Broz

This shoud avoid various races between dmeventd on multiple nodes in cluster where one node already repairing device and another run full scan and locks the device.

---
 lib/activate/dev_manager.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
lib/activate/dev_manager.c +2 -1
index d52d46f..ccafc1e 100644
@@ -130,7 +130,7 @@ int device_is_usable(dev_t dev)
 {
 	struct dm_task *dmt;
 	struct dm_info info;
-	const char *name;
+	const char *name, *uuid;
 	uint64_t start, length;
 	char *target_type = NULL;
 	char *params;
@@ -157,6 +157,7 @@ int device_is_usable(dev_t dev)
 		goto out;
 
 	name = dm_task_get_name(dmt);
+	uuid = dm_task_get_uuid(dmt);
 
 	/* FIXME Also check for mirror block_on_error and mpath no paths */
 	/* For now, we exclude all mirrors */

lib/activate/dev_manager.c int device_is_usable(dev_t dev) · line 176

Quoted 5 lines
lib/activate/dev_manager.c +2 -0
@@ -171,6 +172,11 @@ int device_is_usable(dev_t dev)
 
 	/* FIXME Also check dependencies? */
 
+	/* Check internal lvm devices */
+	if (!is_reserved_lvname(name) && uuid &&

of course

lib/activate/dev_manager.c int device_is_usable(dev_t dev) · line 177

Quoted 1 line
lib/activate/dev_manager.c +1 -0
+	if (is_reserved_lvname(name) && uuid &&

(I just replaced this with apply_lvname_restrictions...)

lib/activate/dev_manager.c int device_is_usable(dev_t dev) · line 182

Quoted 6 lines
lib/activate/dev_manager.c +3 -0
+	    !strncmp(uuid, UUID_PREFIX, sizeof(UUID_PREFIX) - 1))
+		goto out;
+
 	r = 1;
 
       out:

Milan

author
#2 lore raw

PATCH v2 1/1 Skip also special lvm devices in scan (if ignore suspended is used).

In reply to Milan Broz

Skip also special lvm devices in scan (if ignore suspended is used).

This shoud avoid various races between dmeventd on multiple nodes in cluster where one node already repairing device and another run full scan and locks the device.

lib/activate/dev_manager.c +12 -2
index d52d46f..f3cf631 100644
@@ -130,7 +130,7 @@ int device_is_usable(dev_t dev)
 {
 	struct dm_task *dmt;
 	struct dm_info info;
-	const char *name;
+	const char *name, *uuid;
 	uint64_t start, length;
 	char *target_type = NULL;
 	char *params;
@@ -157,6 +157,7 @@ int device_is_usable(dev_t dev)
 		goto out;
 
 	name = dm_task_get_name(dmt);
+	uuid = dm_task_get_uuid(dmt);
 
 	/* FIXME Also check for mirror block_on_error and mpath no paths */
 	/* For now, we exclude all mirrors */
@@ -165,12 +166,21 @@ int device_is_usable(dev_t dev)
 		next = dm_get_next_target(dmt, next, &start, &length,
 					  &target_type, &params);
 		/* Skip if target type doesn't match */
-		if (target_type && !strcmp(target_type, "mirror"))
+		if (target_type && !strcmp(target_type, "mirror")) {
+			log_debug("%s: Mirror device not usable.", name);
 			goto out;
+		}
 	} while (next);
 
 	/* FIXME Also check dependencies? */
 
+	/* Check internal lvm devices */
+	if (is_reserved_lvname(name) && uuid &&
+	    !strncmp(uuid, UUID_PREFIX, sizeof(UUID_PREFIX) - 1)) {
+		log_debug("%s: Reserved internal LVM device not usable.", name);
+		goto out;
+	}
+
 	r = 1;
 
       out:
lib/filters/filter.c +1 -1
index b33d099..03695e3 100644
@@ -133,7 +133,7 @@ static int _passes_lvm_type_device_filter(struct dev_filter *f __attribute((unus
 	/* Skip suspended devices */
 	if (MAJOR(dev->dev) == _device_mapper_major &&
 	    ignore_suspended_devices() && !device_is_usable(dev->dev)) {
-		log_debug("%s: Skipping: Suspended dm device", name);
+		log_debug("%s: Skipping: Suspended or internal dm device", name);
 		return 0;
 	}
 
#3 lore raw

PATCH v2 1/1 Skip also special lvm devices in scan (if ignore suspended is used).

Quoted 5 lines · Milan Broz

Skip also special lvm devices in scan (if ignore suspended is used).

This shoud avoid various races between dmeventd on multiple nodes in cluster where one node already repairing device and another run full scan and locks the device.

I don't know much about the details of scanning, but for all I can tell, the patch looks good. It doesn't seem to make much sense to be scanning mimages and as pointed out it can interfere with other operations and generally cause lots of grief.

Quoted 1 line

Yours,
Petr.