[DRBD-cvs] svn commit by phil - r2419 - trunk/drbd - A thight "drbdadm up r0; drbdadm down r0" loop led me t

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Wed Sep 13 21:23:05 CEST 2006


Author: phil
Date: 2006-09-13 21:23:05 +0200 (Wed, 13 Sep 2006)
New Revision: 2419

Modified:
   trunk/drbd/drbd_actlog.c
Log:
A thight "drbdadm up r0; drbdadm down r0" loop led me to this
bug. drbd_rs_cancel_all() may only look at mdev->resync if
the disk state is >= Inconsistent || Failed. It should not
loot mdev->resync if it is Attaching!



Modified: trunk/drbd/drbd_actlog.c
===================================================================
--- trunk/drbd/drbd_actlog.c	2006-09-13 18:57:54 UTC (rev 2418)
+++ trunk/drbd/drbd_actlog.c	2006-09-13 19:23:05 UTC (rev 2419)
@@ -945,11 +945,17 @@
 {
 	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);
-
-	/* inc_local to make sure mdev->resync is there */
-	if(inc_local_if_state(mdev,Failed)) {
+	if(have_resync) {
 		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;
@@ -960,9 +966,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);
 }



More information about the drbd-cvs mailing list