[DRBD-cvs] svn commit by phil - r2269 - in trunk: drbd drbd/linux user - Made my mind clear about the different meanings of disk

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Mon Jul 10 18:09:51 CEST 2006


Author: phil
Date: 2006-07-10 18:09:49 +0200 (Mon, 10 Jul 2006)
New Revision: 2269

Modified:
   trunk/drbd/drbd_fs.c
   trunk/drbd/drbd_main.c
   trunk/drbd/drbd_req.c
   trunk/drbd/drbd_strings.c
   trunk/drbd/linux/drbd.h
   trunk/user/drbdsetup.c
Log:
Made my mind clear about the different meanings of disk the states:
UpToDate                               -> app IO allowed
Consistent (and all other DiskStates)  -> no app IO

Changed the code in the following places to follow that finding:
* The attach code now may mark the disk as UpToDate.
* Renamed the SS_NoConsistentDisk enum to SS_NoUpToDateDisk 



Modified: trunk/drbd/drbd_fs.c
===================================================================
--- trunk/drbd/drbd_fs.c	2006-07-10 13:58:42 UTC (rev 2268)
+++ trunk/drbd/drbd_fs.c	2006-07-10 16:09:49 UTC (rev 2269)
@@ -561,6 +561,11 @@
 		if(drbd_md_test_flag(mdev->bc,MDF_PeerOutDated)) {
 			ns.pdsk = Outdated;
 		}
+
+		if( ns.disk == Consistent && 
+		    ( ns.pdsk == Outdated || nbc->fencing == DontCare ) ) {
+			ns.disk = UpToDate;
+		}
 		
 		/* All tests on MDF_PrimaryInd, MDF_ConnectedInd, 
 		   MDF_Consistent and MDF_WasUpToDate must happen before 
@@ -827,6 +832,8 @@
 		dec_local(mdev);
 	}
 
+	D_ASSERT( fp > DontCare );
+
 	if( fp == Stonith ) drbd_request_state(mdev,NS(susp,1));
 
 	r=drbd_khelper(mdev,"outdate-peer");
@@ -897,7 +904,7 @@
 
 	while (try++ < 3) {
 		r = _drbd_request_state(mdev,mask,val,0);
-		if( r == SS_NoConsistentDisk && (newstate & DontBlameDrbd) && 
+		if( r == SS_NoUpToDateDisk && (newstate & DontBlameDrbd) && 
 		    ( mdev->state.disk == Inconsistent || 
 		      mdev->state.disk == Outdated ) ) {
 			mask.disk = disk_mask;

Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2006-07-10 13:58:42 UTC (rev 2268)
+++ trunk/drbd/drbd_main.c	2006-07-10 16:09:49 UTC (rev 2269)
@@ -711,14 +711,14 @@
 
 	if( rv <= 0 ) /* already found a reason to abort */;
 	else if( ns.role == Primary && ns.conn < Connected &&
-		 ns.disk <= Outdated ) rv=SS_NoConsistentDisk;
+		 ns.disk < UpToDate ) rv=SS_NoUpToDateDisk;
 
 	else if( fp >= Resource &&
 		 ns.role == Primary && ns.conn < Connected &&
 		 ns.pdsk >= DUnknown ) rv=SS_PrimaryNOP;
 
 	else if( ns.role == Primary && ns.disk <= Inconsistent &&
-		 ns.pdsk <= Inconsistent ) rv=SS_NoConsistentDisk;
+		 ns.pdsk <= Inconsistent ) rv=SS_NoUpToDateDisk;
 	
 	else if( ns.conn > Connected &&
 		 ns.disk < UpToDate && ns.pdsk < UpToDate ) 

Modified: trunk/drbd/drbd_req.c
===================================================================
--- trunk/drbd/drbd_req.c	2006-07-10 13:58:42 UTC (rev 2268)
+++ trunk/drbd/drbd_req.c	2006-07-10 16:09:49 UTC (rev 2269)
@@ -175,8 +175,9 @@
 	sector_t esector, nr_sectors;
 
 	if (mdev->state.disk == UpToDate) return 1;
+	if (mdev->state.disk >= Outdated) return 0;
 	if (mdev->state.disk <  Inconsistent) return 0;
-	// We will have a look at the BitMap
+	// state.disk == Inconsistent   We will have a look at the BitMap
 	nr_sectors = drbd_get_capacity(mdev->this_bdev);
 	esector = sector + (size>>9) -1;
 

Modified: trunk/drbd/drbd_strings.c
===================================================================
--- trunk/drbd/drbd_strings.c	2006-07-10 13:58:42 UTC (rev 2268)
+++ trunk/drbd/drbd_strings.c	2006-07-10 16:09:49 UTC (rev 2269)
@@ -62,8 +62,8 @@
 
 static const char *drbd_state_sw_errors[] = {
 	[-SS_TowPrimaries] = "Multiple primaries now allowed by config",
-	[-SS_NoConsistentDisk] = 
-		"Refusing to be Primary without at least one consistent disk",
+	[-SS_NoUpToDateDisk] = 
+		"Refusing to be Primary without at least one UpToDate disk",
 	[-SS_BothInconsistent] = "Refusing to be inconsistent on both nodes",
 	[-SS_SyncingDiskless] = "Refusing to be syncing and diskless",
 	[-SS_ConnectedOutdates] = "Refusing to be Outdated while Connected",

Modified: trunk/drbd/linux/drbd.h
===================================================================
--- trunk/drbd/linux/drbd.h	2006-07-10 13:58:42 UTC (rev 2268)
+++ trunk/drbd/linux/drbd.h	2006-07-10 16:09:49 UTC (rev 2269)
@@ -241,7 +241,7 @@
 	Outdated,
 	DUnknown,       /* Only used for the peer, never for myself */
 	Consistent,     /* Might be Outdated, might be UpToDate ... */
-	UpToDate,
+	UpToDate,       /* Only this disk state allows applications' IO ! */
 	disk_mask=15
 } drbd_disks_t;
 
@@ -268,7 +268,7 @@
 	SS_Success=1,
 	SS_UnknownError=0, // Used to sleep longer in _drbd_request_state
 	SS_TowPrimaries=-1,
-	SS_NoConsistentDisk=-2,
+	SS_NoUpToDateDisk=-2,
 	SS_BothInconsistent=-4,
 	SS_SyncingDiskless=-5,
 	SS_ConnectedOutdates=-6,

Modified: trunk/user/drbdsetup.c
===================================================================
--- trunk/user/drbdsetup.c	2006-07-10 13:58:42 UTC (rev 2268)
+++ trunk/user/drbdsetup.c	2006-07-10 16:09:49 UTC (rev 2269)
@@ -1087,7 +1087,7 @@
       if(err==EIO) 
 	{
 	  fprintf(stderr,"%s\n",set_st_err_name(reason));
-	  if(reason == SS_NoConsistentDisk) return 17;
+	  if(reason == SS_NoUpToDateDisk) return 17;
 	}
       return 20;
     }



More information about the drbd-cvs mailing list