[DRBD-cvs] svn commit by phil - r2719 - in trunk: documentation drbd drbd/linux user - Implemented the alsays-asbp option. This allowes one to

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Mon Jan 29 18:08:25 CET 2007


Author: phil
Date: 2007-01-29 18:08:23 +0100 (Mon, 29 Jan 2007)
New Revision: 2719

Modified:
   trunk/documentation/drbd.conf.sgml
   trunk/documentation/drbdsetup.sgml
   trunk/drbd/drbd_receiver.c
   trunk/drbd/linux/drbd_nl.h
   trunk/user/drbdadm_scanner.fl
   trunk/user/drbdsetup.c
Log:
Implemented the alsays-asbp option. This allowes one to use
the automatic after split brain policies even if the UUIDs
are ambiguous.


Modified: trunk/documentation/drbd.conf.sgml
===================================================================
--- trunk/documentation/drbd.conf.sgml	2007-01-29 09:57:23 UTC (rev 2718)
+++ trunk/documentation/drbd.conf.sgml	2007-01-29 17:08:23 UTC (rev 2719)
@@ -751,6 +751,24 @@
 	  </listitem>
 </varlistentry>
 
+	<varlistentry>
+	  <term><option>always-asbp</option></term>
+	  <listitem>
+	    <para>
+	      Normally the automatic after-split-brain policies are only 
+	      used if current state of the UUIDs do not indicate the 
+	      presence of a third node.
+	    </para>
+	    <para>
+	      With this option you request that the automatic 
+	      after-split-brain policies are used as long as the data
+	      sets of the nodes are somehow related. This might cause
+	      a full sync, if the UUIDs indicates the presence of a third
+	      node. (Or double faults led to strange UUID sets.)
+	    </para>
+	  </listitem>
+	</varlistentry>
+
 <varlistentry>
   <term><option>rr-conflict </option><replaceable>policy</replaceable></term>
 	  <listitem>

Modified: trunk/documentation/drbdsetup.sgml
===================================================================
--- trunk/documentation/drbdsetup.sgml	2007-01-29 09:57:23 UTC (rev 2718)
+++ trunk/documentation/drbdsetup.sgml	2007-01-29 17:08:23 UTC (rev 2719)
@@ -619,6 +619,25 @@
 	</varlistentry>
 
 	<varlistentry>
+	  <term><option>-P</option>,
+	  <option>--always-asbp</option></term>
+	  <listitem>
+	    <para>
+	      Normally the automatic after-split-brain policies are only 
+	      used if current state of the UUIDs do not indicate the 
+	      presence of a third node.
+	    </para>
+	    <para>
+	      With this option you request that the automatic 
+	      after-split-brain policies are used as long as the data
+	      sets of the nodes are somehow related. This might cause
+	      a full sync, if the UUIDs indicates the presence of a third
+	      node. (Or double faults led to strange UUID sets.)
+	    </para>
+	  </listitem>
+	</varlistentry>
+
+	<varlistentry>
 	  <term><option>-R</option>,
 	  <option>--rr-conflict </option><replaceable>role-resync-conflict-policy</replaceable></term>
 	  <listitem>

Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c	2007-01-29 09:57:23 UTC (rev 2718)
+++ trunk/drbd/drbd_receiver.c	2007-01-29 17:08:23 UTC (rev 2719)
@@ -1884,7 +1884,7 @@
 	*rule_nr = 9;
 	self = mdev->bc->md.uuid[Bitmap] & ~((u64)1);
 	peer = mdev->p_uuid[Bitmap] & ~((u64)1);
-	if (self == peer) return 100;
+	if (self == peer && self != ((u64)0) ) return 100;
 
 	*rule_nr = 10;
 	for ( i=History_start ; i<=History_end ; i++ ) {
@@ -1920,8 +1920,9 @@
 	       INFO("uuid_compare()=%d by rule %d\n",hg,rule_nr);
 	    );
 
-	if (hg == 100) {
+	if (hg == 100 || (hg == -100 && mdev->net_conf->always_asbp) ) {
 		int pcount = (mdev->state.role==Primary) + (peer_role==Primary);
+		int forced = (hg == -100);
 
 		switch (pcount) {
 		case 0:
@@ -1937,6 +1938,13 @@
 		if ( abs(hg) < 100 ) {
 			WARN("Split-Brain detected, %d primaries, automatically solved. Sync from %s node\n",
 			     pcount, (hg < 0) ? "peer":"this");
+			if(forced) {
+				WARN("Doing a full sync, since"
+				     " UUIDs where ambiguous.\n");
+				drbd_uuid_dump(mdev,"self",mdev->bc->md.uuid);
+				drbd_uuid_dump(mdev,"peer",mdev->p_uuid);
+				hg=hg*2;
+			}
 		}
 	}
 

Modified: trunk/drbd/linux/drbd_nl.h
===================================================================
--- trunk/drbd/linux/drbd_nl.h	2007-01-29 09:57:23 UTC (rev 2718)
+++ trunk/drbd/linux/drbd_nl.h	2007-01-29 17:08:23 UTC (rev 2719)
@@ -50,6 +50,7 @@
 	INTEGER(	40,	T_MAY_IGNORE,	ping_timeo)
 	BIT(		27,	T_MAY_IGNORE,	want_lose)
 	BIT(		28,	T_MAY_IGNORE,	two_primaries)
+	BIT(		41,	T_MAY_IGNORE,	always_asbp)
 )
 
 PACKET(disconnect, 6, )

Modified: trunk/user/drbdadm_scanner.fl
===================================================================
--- trunk/user/drbdadm_scanner.fl	2007-01-29 09:57:23 UTC (rev 2718)
+++ trunk/user/drbdadm_scanner.fl	2007-01-29 17:08:23 UTC (rev 2719)
@@ -82,6 +82,7 @@
 ping-timeout 		{ DP; CP; return TK_NET_OPTION;		}
 unplug-watermark	{ DP; CP; return TK_NET_OPTION;         }
 allow-two-primaries	{ DP; CP; return TK_NET_SWITCH;		}
+always-asbp		{ DP; CP; return TK_NET_SWITCH;		}
 rate			{ DP; CP; RC(RATE); return TK_SYNCER_OPTION;	}
 after			{ DP; CP; return TK_SYNCER_OPTION;	}
 al-extents		{ DP; CP; RC(AL_EXTENTS); return TK_SYNCER_OPTION;}

Modified: trunk/user/drbdsetup.c
===================================================================
--- trunk/user/drbdsetup.c	2007-01-29 09:57:23 UTC (rev 2718)
+++ trunk/user/drbdsetup.c	2007-01-29 17:08:23 UTC (rev 2719)
@@ -289,6 +289,7 @@
 		 { "after-sb-0pri",'A',	T_after_sb_0p,EH(asb0p_n,AFTER_SB_0P) },
 		 { "after-sb-1pri",'B',	T_after_sb_1p,EH(asb1p_n,AFTER_SB_1P) },
 		 { "after-sb-2pri",'C',	T_after_sb_2p,EH(asb2p_n,AFTER_SB_2P) },
+		 { "always-asbp",'P',   T_always_asbp,     EB },
 		 { "rr-conflict",'R',	T_rr_conflict,EH(rrcf_n,RR_CONFLICT) },
 		 { "ping-timeout",'p',  T_ping_timeo,	   EN(PING_TIMEO,1) },
 		 { "discard-my-data",'D', T_want_lose,     EB },



More information about the drbd-cvs mailing list