[DRBD-cvs] svn commit by phil - r2013 - branches/drbd-0.7/drbd - There was a bug in the GC code that caused the GC's

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Fri Dec 16 11:55:27 CET 2005


to 
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: phil
Date: 2005-12-16 11:55:26 +0100 (Fri, 16 Dec 2005)
New Revision: 2013

Modified:
   branches/drbd-0.7/drbd/drbd_receiver.c
Log:
There was a bug in the GC code that caused the GC's
to diverge when there was one of the modifiers (--human,
--timeout-expired, --do-what-I-say) used when making 
a node primary. 

Usually this was not noticed, because there are lots of
events that caused the GCs to get in sync again. But at 
initialisation time (one has to use --do-what-I-say primary)
the bug could cause an attempt of a wrong sync (which was
actually prevented by some sanity code) if these commands
where issued on the primary: 
secondary, down, attach, primary, connect.

Fixed now.



Modified: branches/drbd-0.7/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_receiver.c	2005-12-02 12:52:23 UTC (rev 2012)
+++ branches/drbd-0.7/drbd/drbd_receiver.c	2005-12-16 10:55:26 UTC (rev 2013)
@@ -1376,7 +1376,7 @@
 {
 	Drbd_Parameter_Packet *p = (Drbd_Parameter_Packet*)h;
 	int consider_sync;
-	int oo_state;
+	int oo_state,i;
 	sector_t p_size, p_usize;
 
 	if (h->length != (sizeof(*p)-sizeof(*h))) {
@@ -1562,8 +1562,12 @@
 	oo_state = mdev->o_state;
 	mdev->o_state = be32_to_cpu(p->state);
 	if(oo_state == Secondary && mdev->o_state == Primary) {
-		drbd_md_inc(mdev,ConnectedCnt);
+		/* Secondary has to adopt primary's gen_cnt. */
+		for(i=HumanCnt;i<GEN_CNT_SIZE;i++) {
+			mdev->gen_cnt[i]=be32_to_cpu(p->gen_cnt[i]);
+		}
 	}
+
 	if (oo_state != mdev->o_state) {
 		INFO( "%s/%s --> %s/%s\n",
 		      nodestate_to_name(mdev->state),



More information about the drbd-cvs mailing list