Skip to contentSkip to conversation

LVM2 ./WHATS_NEW daemons/clvmd/lvm-functions.c ...

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

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mbroz at sourceware.org 2010-01-19 13:25:00

Modified files:

	.              : WHATS_NEW 
	daemons/clvmd  : lvm-functions.c 
	lib/commands   : toolcontext.c 

Log message:
Never scan suspended devices in clvmd.

For mirror repair (and similar tasks) it can happen that full device rescan is issued from clvmd.

Because code can be in the middle of repair (calling suspend) clvmd should never try to scan suspended devices (otherwise it causes deadlock).

Also code must not change ignore_suspended_device flag when doing refresh_filters (called from lvmcache scan code).

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1394&r2=1.1395
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/lvm-functions.c.diff?cvsroot=lvm2&r1=1.82&r2=1.83
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.90&r2=1.91

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 2.02.59 - 
 ===================================
+  Fix clvmd to never scan suspended devices.
   Initial version of the cmirror init script (Red Hat).
   Initial version of the cmirrord man page.
   Make cluster log communication structures architecture independant.
daemons/clvmd/lvm-functions.c +5 -0
@@ -499,6 +499,9 @@
 
 	cmd->partial_activation = (lock_flags & LCK_PARTIAL_MODE) ? 1 : 0;
 
+	/* clvmd should never try to read suspended device */
+	init_ignore_suspended_devices(1);
+
 	switch (command & LCK_MASK) {
 	case LCK_LV_EXCLUSIVE:
 		status = do_activate_lv(resource, lock_flags, LKM_EXMODE);
@@ -627,6 +630,7 @@
 	}
 
 	init_full_scan_done(0);
+	init_ignore_suspended_devices(1);
 	lvmcache_label_scan(cmd, 2);
 	dm_pool_empty(cmd->mem);
 
@@ -860,6 +864,7 @@
 
 	/* Check lvm.conf is setup for cluster-LVM */
 	check_config();
+	init_ignore_suspended_devices(1);
 
 	/* Remove any non-LV locks that may have been left around */
 	if (using_gulm)
lib/commands/toolcontext.c +10 -1
@@ -1231,12 +1231,21 @@
 
 int refresh_filters(struct cmd_context *cmd)
 {
+	int r, saved_ignore_suspended_devices = ignore_suspended_devices();
+
 	if (cmd->filter) {
 		cmd->filter->destroy(cmd->filter);
 		cmd->filter = NULL;
 	}
 
-	return _init_filters(cmd, 0);
+	r = _init_filters(cmd, 0);
+
+	/*
+	 * During repair code must not reset suspended flag.
+	 */
+	init_ignore_suspended_devices(saved_ignore_suspended_devices);
+
+	return r;
 }
 
 int refresh_toolcontext(struct cmd_context *cmd)