[DRBD-cvs] svn commit by lars - r2558 - trunk/drbd - fix remaining bug in drbd_resync_finished. there may no

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Mon Oct 23 16:23:18 CEST 2006


Author: lars
Date: 2006-10-23 16:23:17 +0200 (Mon, 23 Oct 2006)
New Revision: 2558

Modified:
   trunk/drbd/drbd_actlog.c
Log:
fix remaining bug in drbd_resync_finished.
there may now be one remaining reference in the resync lru,
in case the last bit got cleared by application io.


Modified: trunk/drbd/drbd_actlog.c
===================================================================
--- trunk/drbd/drbd_actlog.c	2006-10-23 14:19:11 UTC (rev 2557)
+++ trunk/drbd/drbd_actlog.c	2006-10-23 14:23:17 UTC (rev 2558)
@@ -967,7 +967,7 @@
 	    );
 
 	spin_lock_irq(&mdev->al_lock);
-	if (mdev->resync_wenr != LC_FREE) {
+	if (mdev->resync_wenr != LC_FREE && mdev->resync_wenr != enr) {
 		/* in case you have very heavy scattered io, it may
 		 * stall the syncer undefined if we giveup the ref count
 		 * when we try again and requeue.
@@ -1151,7 +1151,27 @@
 		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;
-			D_ASSERT(bm_ext->lce.refcnt == 0);
+			if(bm_ext->lce.refcnt != 0) {
+				if (bm_ext->lce.refcnt != 1) {
+					ALERT("LOGIC BUG detected in %s:%d\n", __FILE__ , __LINE__ );
+					/* this should not happen. but rather
+					 * have some asserts trigger
+					 * than BUG() in lc_del! */
+					continue;
+				}
+				if (bm_ext->lce.lc_number != mdev->resync_wenr) {
+					ALERT("LOGIC BUG detected in %s:%d\n", __FILE__ , __LINE__ );
+					continue;
+				}
+				INFO("dropping %u in drbd_rs_del_all, "
+				     "aparently got 'synced' by application io\n",
+				     mdev->resync_wenr);
+				D_ASSERT(!test_bit(BME_LOCKED,&bm_ext->flags));
+				D_ASSERT(test_bit(BME_NO_WRITES,&bm_ext->flags));
+				clear_bit(BME_NO_WRITES,&bm_ext->flags);
+				mdev->resync_wenr = LC_FREE;
+				lc_put(mdev->resync,&bm_ext->lce);
+			}
 			D_ASSERT(bm_ext->rs_left == 0);
 			D_ASSERT(!test_bit(BME_LOCKED,&bm_ext->flags));
 			D_ASSERT(!test_bit(BME_NO_WRITES,&bm_ext->flags));



More information about the drbd-cvs mailing list