[DRBD-cvs] svn commit by phil - r2655 - trunk/drbd - * In case a resync is started while heavy application I

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Thu Jan 4 14:25:54 CET 2007


Author: phil
Date: 2007-01-04 14:25:51 +0100 (Thu, 04 Jan 2007)
New Revision: 2655

Modified:
   trunk/drbd/drbd_int.h
   trunk/drbd/drbd_main.c
   trunk/drbd/drbd_receiver.c
Log:
* In case a resync is started while heavy application IO is going on
  on both nodes (pri-pri clusters) it was possible that a node 
  returned RSWriteAck before the receiver node finished writing
  its bitmap. The result where uggly bugs.
  
  Fixed that by inidicating the willingness to receive RSWriteAck
  in already in the Data Packet.
 
  New flag for the DataPacket: DP_MAY_SET_IN_SYNC
  New flag for EEs:            EE_MAY_SET_IN_SYNC

* Fixed the _drbd_uuid_set() function to only set the 
  primary indicating bit for the "Current" UUID.


Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h	2007-01-03 09:49:46 UTC (rev 2654)
+++ trunk/drbd/drbd_int.h	2007-01-04 13:25:51 UTC (rev 2655)
@@ -400,8 +400,9 @@
  *   Data, DataReply (see Drbd_Data_Packet)
  */
 
-#define DP_HARDBARRIER 1
-#define DP_RW_SYNC     2
+#define DP_HARDBARRIER        1
+#define DP_RW_SYNC            2
+#define DP_MAY_SET_IN_SYNC    4
 
 typedef struct {
 	Drbd_Header head;
@@ -665,11 +666,12 @@
 enum {
 	__EE_CALL_AL_COMPLETE_IO,
 	__EE_CONFLICT_PENDING,
+	__EE_MAY_SET_IN_SYNC,
 };
 #define EE_CALL_AL_COMPLETE_IO (1<<__EE_CALL_AL_COMPLETE_IO)
 #define EE_CONFLICT_PENDING    (1<<__EE_CONFLICT_PENDING)
+#define EE_MAY_SET_IN_SYNC     (1<<__EE_MAY_SET_IN_SYNC)
 
-
 /* global flag bits */
 enum {
 	ISSUE_BARRIER,		// next Data is preceeded by a Barrier

Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2007-01-03 09:49:46 UTC (rev 2654)
+++ trunk/drbd/drbd_main.c	2007-01-04 13:25:51 UTC (rev 2655)
@@ -1667,11 +1667,15 @@
 				  atomic_add_return(1,&mdev->packet_seq) );
 	dp_flags = 0;
 	if(req->master_bio->bi_rw & BIO_RW_BARRIER) {
-		dp_flags = DP_HARDBARRIER;
+		dp_flags |= DP_HARDBARRIER;
 	}
 	if(req->master_bio->bi_rw & BIO_RW_SYNC) {
-		dp_flags = DP_RW_SYNC;
+		dp_flags |= DP_RW_SYNC;
 	}
+	if(mdev->state.conn >= SyncSource && 
+	   mdev->state.conn <= PausedSyncT) {
+		dp_flags |= DP_MAY_SET_IN_SYNC;
+	}
 
 	p.dp_flags = cpu_to_be32(dp_flags);
 	dump_packet(mdev,mdev->data.socket,0,(void*)&p, __FILE__, __LINE__);
@@ -2681,12 +2685,16 @@
 
 void _drbd_uuid_set(drbd_dev *mdev, int idx, u64 val)
 {
-	if (mdev->state.role == Primary) {
-		mdev->bc->md.uuid[idx] = val | 1;
-	} else {
-		mdev->bc->md.uuid[idx] = val & ~((u64)1);
+	if(idx == Current) {
+		if (mdev->state.role == Primary) {
+			val |= 1;
+		} else {
+			val &= ~((u64)1);
+		}
 	}
 
+	mdev->bc->md.uuid[idx] = val;
+
 	MTRACE(TraceTypeUuid,TraceLvlSummary,
 	       drbd_print_uuid(mdev,idx);
 		);

Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c	2007-01-03 09:49:46 UTC (rev 2654)
+++ trunk/drbd/drbd_receiver.c	2007-01-04 13:25:51 UTC (rev 2655)
@@ -1174,7 +1174,8 @@
 	if(mdev->net_conf->wire_protocol == DRBD_PROT_C) {
 		if(likely(drbd_bio_uptodate(e->private_bio))) {
 			pcmd = (mdev->state.conn >= SyncSource && 
-				mdev->state.conn <= PausedSyncT) ?
+				mdev->state.conn <= PausedSyncT &&
+				e->flags & EE_MAY_SET_IN_SYNC) ?
 				RSWriteAck : WriteAck;
 			ok &= drbd_send_ack(mdev,pcmd,e);
 			if(pcmd==RSWriteAck)
@@ -1330,6 +1331,9 @@
 	if ( dp_flags & DP_RW_SYNC ) {
 		e->private_bio->bi_rw |= BIO_RW_SYNC;
 	}
+	if ( dp_flags & DP_MAY_SET_IN_SYNC ) {
+		e->flags |= EE_MAY_SET_IN_SYNC;
+	}
 
 	/* I'm the receiver, I do hold a net_cnt reference. */
 	if (!mdev->net_conf->two_primaries) {



More information about the drbd-cvs mailing list