[DRBD-cvs] svn commit by phil - r2968 - branches/drbd-8.0/drbd - For the discard-younger / discard-older after-sb-0pri p

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Thu Jul 12 17:45:10 CEST 2007


Author: phil
Date: 2007-07-12 17:45:09 +0200 (Thu, 12 Jul 2007)
New Revision: 2968

Modified:
   branches/drbd-8.0/drbd/drbd_nl.c
Log:
For the discard-younger / discard-older after-sb-0pri policies
to work, we need to follow the node roles more closely.


Modified: branches/drbd-8.0/drbd/drbd_nl.c
===================================================================
--- branches/drbd-8.0/drbd/drbd_nl.c	2007-07-12 14:44:02 UTC (rev 2967)
+++ branches/drbd-8.0/drbd/drbd_nl.c	2007-07-12 15:45:09 UTC (rev 2968)
@@ -320,6 +320,10 @@
 
 	if (new_role == Secondary) {
 		set_disk_ro(mdev->vdisk, TRUE );
+		if ( inc_local(mdev) ) {
+			mdev->bc->md.uuid[Current] &= ~(u64)1;
+			dec_local(mdev);
+		}
 	} else {
 		if(inc_net(mdev)) {
 			mdev->net_conf->want_lose = 0;
@@ -336,6 +340,7 @@
 			       mdev->bc->md.uuid[Bitmap] == 0) || forced ) {
 				drbd_uuid_new_current(mdev);
 			}
+			mdev->bc->md.uuid[Current] |=  (u64)1;
 			dec_local(mdev);
 		}
 	}
@@ -991,6 +996,13 @@
 	}
 
 	drbd_bm_unlock(mdev);
+
+	if(inc_local_if_state(mdev,Attaching)) {
+		if(mdev->state.role == Primary) mdev->bc->md.uuid[Current] |=  (u64)1;
+		else                            mdev->bc->md.uuid[Current] &= ~(u64)1;
+		dec_local(mdev);
+	}
+
 	drbd_md_sync(mdev);
 
 	reply->ret_code = retcode;



More information about the drbd-cvs mailing list