Skip to contentSkip to conversation

LVM2 ./WHATS_NEW daemons/dmeventd/plugins/mirr ...

PATCH [email protected] 1 participant 1 message Jan 6, 2010

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mbroz at sourceware.org 2010-01-06 13:26:22

Modified files:
. : WHATS_NEW
daemons/dmeventd/plugins/mirror: dmeventd_mirror.c
tools : lvconvert.c

Log message:
Remove empty "repaired" devices if empty in lvconvert.

The logic was that lvconvert repair volumes, marking PV as MISSING and following vgreduce --removemissing removes these missing devices.

Previously dmeventd mirror DSO removed all LV and PV from VG by simply relying on
vgreduce --removemissing --force.

Now, there are two subsequent calls:
lvconvert --repair --use-policies
vgreduce --removemissing

So the VG is locked twice, opening space for all races between other running lvm processes. If the PV reappears with old metadata on it (so the winner performs autorepair, if locking VG for update) the situation is even worse.

Patch simply adds removemissing PV functionality into lvconcert BUT ONLY if running with --repair and --use-policies and removing only these empty missing PVs which are involved in repair.
(This combination is expected to run only from dmeventd.)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1365&r2=1.1366
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c.diff?cvsroot=lvm2&r1=1.28&r2=1.29
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.99&r2=1.100

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 2.02.57 -
 ====================================
+  Remove empty PV devices if lvconvert --repair is using defined policies.
   Use fixed buffer to prevent stack overflow in persistent filter dump.
   Use snapshot metadata usage to determine if a snapshot is empty.
   Insert missing stack macros to all activate_lv and deactivate_lv callers.
daemons/dmeventd/plugins/mirror/dmeventd_mirror.c +1 -5
@@ -193,11 +193,7 @@
 
 	r = lvm2_run(_lvm_handle, cmd_str);
 
-	if (r == ECMD_PROCESSED) {
-		snprintf(cmd_str, CMD_SIZE, "vgreduce --removemissing %s", vg);
-		if (lvm2_run(_lvm_handle, cmd_str) != 1)
-			syslog(LOG_ERR, "Unable to remove failed PVs from VG %s", vg);
-	}
+	syslog(LOG_INFO, "Repair of mirrored LV %s/%s %s.", vg, lv, (r == ECMD_PROCESSED) ? "finished successfully" : "failed");
 
 	dm_pool_empty(_mem_pool);  /* FIXME: not safe with multiple threads */
 	return (r == ECMD_PROCESSED) ? 0 : -1;
tools/lvconvert.c +54 -1

85 lines not on this page · raw message