Skip to contentSkip to conversation

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

Cluster-devel [email protected] 1 participant 1 message Mar 2, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL4
Changes by: jbrassow at sourceware.org 2007-03-02 22:31:14

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

Log message:
- When a cluster log resumes, the server must re-read the log device. However, it doesn't _need_ to happen until a request comes in which forces an election.

If a resume/suspend loop is tight enough, it is possible for a log read to happen after the log device has been suspended.

The fix is to force the log read during the resume call.

Bug 227398: cmirror request to LRT_CLEAR_REGION fails...

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.39&r2=1.1.2.40

cmirror-kernel/src/Attic/dm-cmirror-client.c +9 -6
@@ -305,7 +305,8 @@
 		lc->server_id = lr.u.lr_coordinator;
 	} else {
 		/* ATTENTION -- what do we do with this ? */
-		DMWARN("Failed to receive election results from server: %d", len);
+		DMWARN("Failed to receive election results from server: (%s,%d)",
+		       lc->uuid + (strlen(lc->uuid) - 8), len);
 		error = len;
 	}
 
@@ -464,6 +465,8 @@
 			       (type == LRT_ELECTION)? "LRT_ELECTION":
 			       (type == LRT_SELECTION)? "LRT_SELECTION": "UNKNOWN");
 			DMDEBUG(" - error   :: %d", error);
+			DMINFO("Too many retries, attempting to re-establish server connection.");
+			lc->server_id = 0xDEAD;
 		}
 	}
 
@@ -764,11 +767,6 @@
 	list_del_init(&lc->log_list);
 	spin_unlock(&log_list_lock);
 
-	if ((lc->server_id == my_id) && !atomic_read(&lc->suspended))
-		consult_server(lc, 0, LRT_MASTER_LEAVING, NULL);
-
-	sock_release(lc->client_sock);
-
 	spin_lock(&region_state_lock);
 
 	list_for_each_entry_safe(rs, tmp_rs, &clear_region_list, rs_list) {
@@ -783,6 +781,10 @@
 
 	spin_unlock(&region_state_lock);
 
+	if ((lc->server_id == my_id) && !atomic_read(&lc->suspended))
+		consult_server(lc, 0, LRT_MASTER_LEAVING, NULL);
+
+	sock_release(lc->client_sock);
 
 	if (lc->log_dev)
 		disk_dtr(log);
@@ -842,6 +844,7 @@
 	lc->sync_search = 0;
 	resume_server_requests();
 	atomic_set(&lc->suspended, 0);
+	consult_server(lc, 0, LRT_IN_SYNC, NULL);
 
 	return 0;
 }