[DRBD-cvs] svn commit by phil - r2454 - trunk/drbd - While fixing one of the bugs Simon pointed out: you can

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Mon Sep 25 15:16:51 CEST 2006


Author: phil
Date: 2006-09-25 15:16:50 +0200 (Mon, 25 Sep 2006)
New Revision: 2454

Modified:
   trunk/drbd/drbd_int.h
   trunk/drbd/drbd_main.c
   trunk/drbd/drbd_nl.c
   trunk/drbd/drbd_receiver.c
Log:
While fixing one of the bugs Simon pointed out:

  you can actually do 'drbdadm disconnect' on the secondary side,
  when the other is primary/inconsistent.

I removed the OutdateRequest and the OutdatedReply packets,
and insead do this communication via the cluster-wide-
state changes.


Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h	2006-09-25 11:32:44 UTC (rev 2453)
+++ trunk/drbd/drbd_int.h	2006-09-25 13:16:50 UTC (rev 2454)
@@ -312,8 +312,6 @@
 	ResumeResync,
 	AuthChallenge,
 	AuthResponse,
-	OutdateRequest,
-	OutdatedReply,
 	StateChgRequest,
 
 	Ping,         // These are sent on the meta socket...
@@ -362,8 +360,6 @@
 		[ResumeResync]     = "ResumeResync",
 		[AuthChallenge]    = "AuthChallenge",
 		[AuthResponse]     = "AuthResponse",
-		[OutdateRequest]   = "OutdateRequest",
-		[OutdatedReply]    = "OutdatedReply",
 		[Ping]             = "Ping",
 		[PingAck]          = "PingAck",
 		[RecvAck]          = "RecvAck",

Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2006-09-25 11:32:44 UTC (rev 2453)
+++ trunk/drbd/drbd_main.c	2006-09-25 13:16:50 UTC (rev 2454)
@@ -396,10 +396,8 @@
 		 ( ( os.role != Primary && ns.role == Primary ) ||
 		   ( os.conn != StartingSyncT && ns.conn == StartingSyncT ) ||
 		   ( os.conn != StartingSyncS && ns.conn == StartingSyncS ) ||
-		   ( os.disk != Diskless && ns.disk == Diskless ) ||
-		   // ( os.conn != TearDown && ns.conn == TearDown ) ||
-		   0
-		   ) );
+		   ( os.disk != Diskless && ns.disk == Diskless ) ) ) ||
+		(os.conn >= Connected && ns.conn == Disconnecting);
 }
 
 int drbd_change_state(drbd_dev* mdev, enum chg_state_flags f,

Modified: trunk/drbd/drbd_nl.c
===================================================================
--- trunk/drbd/drbd_nl.c	2006-09-25 11:32:44 UTC (rev 2453)
+++ trunk/drbd/drbd_nl.c	2006-09-25 13:16:50 UTC (rev 2454)
@@ -1110,14 +1110,15 @@
 	retcode = _drbd_request_state(mdev,NS(conn,Disconnecting),0);	// silently.
 
 	if ( retcode == SS_NothingToDo ) goto done;
-	if ( retcode == SS_PrimaryNOP ) {
-		drbd_send_short_cmd(mdev, OutdateRequest);
-		wait_event(mdev->cstate_wait,
-			   mdev->state.pdsk <= Outdated ||
-			   mdev->state.conn < TearDown );
-		if( mdev->state.conn < TearDown ) goto done;
-
-		retcode = drbd_request_state(mdev,NS(conn,Disconnecting));
+	else if ( retcode == AlreadyStandAlone ) goto done;
+	else if ( retcode == SS_PrimaryNOP ) {
+		// Our statche checking code wants to see the peer outdated.
+		retcode = drbd_request_state(mdev,NS2(conn,Disconnecting,
+						      pdsk,Outdated));
+	} else if (retcode == SS_CW_FailedByPeer) {
+		// The peer probabely wants to see us outdated.
+		retcode = drbd_request_state(mdev,NS2(conn,Disconnecting,
+						      disk,Outdated));
 	}
 
 	if( retcode < SS_Success ) goto fail;

Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c	2006-09-25 11:32:44 UTC (rev 2453)
+++ trunk/drbd/drbd_receiver.c	2006-09-25 13:16:50 UTC (rev 2454)
@@ -2079,6 +2079,7 @@
 
 		[StartingSyncS] = StartingSyncT,
 		[StartingSyncT] = StartingSyncS,
+		[Disconnecting] = TearDown, // NetworkFailure,
 
 		[conn_mask]   = conn_mask,
 	};
@@ -2309,44 +2310,6 @@
 	return TRUE; // cannot fail.
 }
 
-STATIC int receive_outdate(drbd_dev *mdev, Drbd_Header *h)
-{
-	drbd_state_t os,ns;
-	int r;
-
-	spin_lock_irq(&mdev->req_lock);
-	os = mdev->state;
-	if( os.disk < Outdated ) {
-		r=-999;
-	} else {
-		r = _drbd_set_state(mdev, _NS2(disk,Outdated,conn,TearDown),
-				    ChgStateVerbose);
-	}
-	ns = mdev->state;
-	spin_unlock_irq(&mdev->req_lock);
-	if( r == SS_Success) after_state_ch(mdev,os,ns,ChgStateVerbose);
-
-	if( r >= SS_Success) {
-		drbd_md_sync(mdev);
-		drbd_send_short_cmd(mdev, OutdatedReply);
-		return TRUE;
-	}
-
-	return FALSE;
-}
-
-STATIC int receive_outdated(drbd_dev *mdev, Drbd_Header *h)
-{
-	int r;
-
-	r = drbd_request_state(mdev,NS2(pdsk,Outdated,conn,TearDown));
-	WARN("r=%d\n",r);
-	D_ASSERT(r >= SS_Success);
-	drbd_md_sync(mdev); // because drbd_request_state created a new UUID.
-
-	return TRUE;
-}
-
 typedef int (*drbd_cmd_handler_f)(drbd_dev*,Drbd_Header*);
 
 static drbd_cmd_handler_f drbd_default_handler[] = {
@@ -2372,8 +2335,6 @@
 	[ReportSyncUUID]   = receive_sync_uuid,
 	[PauseResync]      = receive_pause_resync,
 	[ResumeResync]     = receive_resume_resync,
-	[OutdateRequest]   = receive_outdate,
-	[OutdatedReply]    = receive_outdated,
 };
 
 static drbd_cmd_handler_f *drbd_cmd_handler = drbd_default_handler;



More information about the drbd-cvs mailing list