[DRBD-cvs] svn commit by phil - r2422 - in trunk/drbd: . linux - Changed the order of the Failed and the Attaching disk_

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Thu Sep 14 14:13:18 CEST 2006


Author: phil
Date: 2006-09-14 14:13:17 +0200 (Thu, 14 Sep 2006)
New Revision: 2422

Modified:
   trunk/drbd/drbd_actlog.c
   trunk/drbd/drbd_main.c
   trunk/drbd/drbd_nl.c
   trunk/drbd/linux/drbd.h
Log:
Changed the order of the Failed and the Attaching disk_state_t.

Becuase when state.disk >= Failes it is ok to access mdev->bc, while
when state.disk == Attaching || state.disk == Diskless it is not
valid to access mdev->bc.



Modified: trunk/drbd/drbd_actlog.c
===================================================================
--- trunk/drbd/drbd_actlog.c	2006-09-14 09:07:18 UTC (rev 2421)
+++ trunk/drbd/drbd_actlog.c	2006-09-14 12:13:17 UTC (rev 2422)
@@ -945,17 +945,10 @@
 {
 	struct bm_extent* bm_ext;
 	int i;
-	int have_resync;
 
-	/* inc_local variation to make sure mdev->resync is there */
-	spin_lock_irq(&mdev->req_lock);
-	atomic_inc(&mdev->local_cnt);
-	have_resync = ( mdev->state.disk >= Inconsistent || 
-			mdev->state.disk == Failed);
-	spin_unlock_irq(&mdev->req_lock);
-
 	spin_lock_irq(&mdev->al_lock);
-	if(have_resync) {
+
+	if(inc_md_only(mdev,Failed)) { // Makes sure mdev->resync is there.
 		for(i=0;i<mdev->resync->nr_elements;i++) {
 			bm_ext = (struct bm_extent*) lc_entry(mdev->resync,i);
 			if(bm_ext->lce.lc_number == LC_FREE) continue;
@@ -966,9 +959,9 @@
 			lc_del(mdev->resync,&bm_ext->lce);
 		}
 		mdev->resync->used=0;
+		dec_local(mdev);
 	}
 	atomic_set(&mdev->resync_locked,0);
 	spin_unlock_irq(&mdev->al_lock);
 	wake_up(&mdev->al_wait);
-	dec_local(mdev);
 }

Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2006-09-14 09:07:18 UTC (rev 2421)
+++ trunk/drbd/drbd_main.c	2006-09-14 12:13:17 UTC (rev 2422)
@@ -357,7 +357,6 @@
 		_drbd_set_state(mdev,_NS(disk,Diskless),
 				ChgStateHard|ScheduleAfter);
 	}
-	D_ASSERT(mdev->state.disk <= Failed);
 	spin_unlock_irqrestore(&mdev->req_lock,flags);
 
 	if(!send) return ok;

Modified: trunk/drbd/drbd_nl.c
===================================================================
--- trunk/drbd/drbd_nl.c	2006-09-14 09:07:18 UTC (rev 2421)
+++ trunk/drbd/drbd_nl.c	2006-09-14 12:13:17 UTC (rev 2422)
@@ -274,7 +274,7 @@
 		mdev->this_bdev->bd_disk = mdev->vdisk;
 
 		if ( ( ( mdev->state.conn < Connected ||
-			 mdev->state.pdsk <= Attaching ) &&
+			 mdev->state.pdsk <= Failed ) &&
 		       mdev->bc->md.uuid[Bitmap] == 0) || forced ) {
 			drbd_uuid_new_current(mdev);
 		}

Modified: trunk/drbd/linux/drbd.h
===================================================================
--- trunk/drbd/linux/drbd.h	2006-09-14 09:07:18 UTC (rev 2421)
+++ trunk/drbd/linux/drbd.h	2006-09-14 12:13:17 UTC (rev 2422)
@@ -152,8 +152,8 @@
 
 typedef enum {
 	Diskless,
+	Attaching,      /* In the process of reading the meta-data */
 	Failed,         /* Becomes Diskless as soon as we told it the peer */
-	Attaching,      /* In the process of reading the meta-data */
 	Inconsistent,
 	Outdated,
 	DUnknown,       /* Only used for the peer, never for myself */



More information about the drbd-cvs mailing list