Skip to contentSkip to conversation

cluster/cmirror-kernel/src dm-cmirror-client.c ...

Cluster-devel [email protected] 1 participant 1 message Sep 13, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL4
Changes by: jbrassow at sourceware.org 2007-09-13 15:24:20

Modified files:
cmirror-kernel/src: dm-cmirror-client.c dm-cmirror-server.c

Log message:
Bug 257881: Flush/recovery collision leads to deadlock after leg ...

The procedure for coordinating nominal I/O and recovery I/O, was to either:
1) delay a flush which contained a mark to a region being recovered
2) skip over regions that are currently marked when assigning recovery

This bug has to do with the way #1 was implemented.

The following scenario would trigger it:
1) node1 is assigned recovery on region X
2) node1 also does a mark (write) on region Y
3) node2 attempts to mark region X
**) any flush issued here will delay waiting for recovery to complete on X
4) node1 needs to perform the flush before it can get on with completing recovery - but it can't flush, so everyone is delayed *forever*.

The fix was to allow flushes from nodes that are not attempting to mark regions that are being recovered. In the example above, node1 should be allowed to complete the flush because it is not trying to write to the same region that is being recovered. node2 would be correctly delayed. Since node1 can complete the flush, it can also complete the recovery - thus allowing things to proceed.

This bug only affects mirrors that are not in-sync and are doing I/O. This bug can occur whether there are device/machine failures or not. This bug is most easily reproduced with a number of mirrors, but would be possible with just one.

I've also fixed up some debugging output so it is more consistent and easier to follow the flow of events.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror-kernel/src/dm-cmirror-client.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.2.50&r2=1.1.2.51
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror-kernel/src/dm-cmirror-server.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.2.36&r2=1.1.2.37

cmirror-kernel/src/Attic/dm-cmirror-client.c +13 -4
@@ -946,7 +946,8 @@
 
 	while ((r = consult_server(lc, 0, LRT_FLUSH, NULL))) {
 		if (r == -EBUSY) {
-			DMDEBUG("Delaying flush due to recovery");
+			DMDEBUG("Delaying flush due to recovery (%s)",
+				lc->uuid + (strlen(lc->uuid) - 8));
 			set_current_state(TASK_INTERRUPTIBLE);
 			schedule_timeout(HZ);
 			continue;
@@ -1110,8 +1111,8 @@
 	}
 
 	if (rtn)
-		DMDEBUG("Client received resync work: %Lu/%s",
-			*region, lc->uuid + (strlen(lc->uuid) - 8));
+		DMDEBUG("Received recovery work from %u: %Lu/%s",
+			lc->server_id, *region, lc->uuid + (strlen(lc->uuid) - 8));
 
 	/*
 	 * Check for bug 235039
@@ -1137,12 +1138,19 @@
 	region_t success_tmp = success;
 	struct log_c *lc = (struct log_c *) log->context;
 
+	if (success)
+		DMDEBUG("Client finishing recovery: %Lu/%s",
+			region, lc->uuid + (strlen(lc->uuid) - 8));
+	else
+		DMDEBUG("Notifying server(%u) of sync change: %Lu/%s",
+			lc->server_id, region,
+			lc->uuid + (strlen(lc->uuid) - 8));
 	for (i = 0; i < 5; i++) {
 		if (!consult_server(lc, region,
 				    LRT_COMPLETE_RESYNC_WORK, &success_tmp))
 			break;
 		success_tmp = success;
-		DMWARN("Unable to notify server of completed resync work");
+		DMWARN("Unable to notify server of sync state change");
 	}
 	return;
 }
@@ -1203,6 +1211,7 @@
 		DMDEBUG("LOG INFO:");
 		DMDEBUG("  uuid: %s", lc->uuid);
 		DMDEBUG("  uuid_ref    : %d", lc->uuid_ref);
+		DMDEBUG("  log type    : %s", (lc->log_dev) ? "disk" : "core");
 		DMDEBUG(" ?region_count: %Lu", lc->region_count);
 		DMDEBUG(" ?sync_count  : %Lu", lc->sync_count);
 		DMDEBUG(" ?sync_search : %d", lc->sync_search);
cmirror-kernel/src/Attic/dm-cmirror-server.c +27 -14

81 lines not on this page · raw message