[DRBD-cvs] svn commit by phil - r2740 - trunk/drbd - Since drbd_try_clear_on_disk_bm() looks at mdev->resync

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Wed Feb 7 13:52:57 CET 2007


Author: phil
Date: 2007-02-07 13:52:56 +0100 (Wed, 07 Feb 2007)
New Revision: 2740

Modified:
   trunk/drbd/drbd_actlog.c
Log:
Since drbd_try_clear_on_disk_bm() looks at mdev->resync the callers
of this function should get a local reference first.


Modified: trunk/drbd/drbd_actlog.c
===================================================================
--- trunk/drbd/drbd_actlog.c	2007-02-06 16:47:50 UTC (rev 2739)
+++ trunk/drbd/drbd_actlog.c	2007-02-07 12:52:56 UTC (rev 2740)
@@ -805,6 +805,7 @@
 
 /* ATTENTION. The AL's extents are 4MB each, while the extents in the
  * resync LRU-cache are 16MB each.
+ * The caller of this function has to hold an inc_local() reference.
  *
  * TODO will be obsoleted once we have a caching lru of the on disk bitmap
  */
@@ -817,6 +818,7 @@
 	unsigned int enr;
 
 	MUST_HOLD(&mdev->al_lock);
+	D_ASSERT(atomic_read(&mdev->local_cnt));
 
 	// I simply assume that a sector/size pair never crosses
 	// a 16 MB extent border. (Currently this is true...)
@@ -952,7 +954,10 @@
 				mdev->rs_mark_left =drbd_bm_total_weight(mdev);
 			}
 		}
-		drbd_try_clear_on_disk_bm(mdev,sector,count,TRUE);
+		if( inc_local_if_state(mdev,Attaching) ) {
+			drbd_try_clear_on_disk_bm(mdev,sector,count,TRUE);
+			dec_local(mdev);
+		}
 		/* just wake_up unconditional now,
 		 * various lc_chaged(), lc_put() in drbd_try_clear_on_disk_bm(). */
 		wake_up=1;
@@ -1424,7 +1429,10 @@
 	if (count) {
 		mdev->rs_failed += count;
 
-		drbd_try_clear_on_disk_bm(mdev,sector,count,FALSE);
+		if( inc_local_if_state(mdev,Attaching) ) {
+			drbd_try_clear_on_disk_bm(mdev,sector,count,FALSE);
+			dec_local(mdev);
+		}
 
 		/* just wake_up unconditional now,
 		 * various lc_chaged(), lc_put() in drbd_try_clear_on_disk_bm(). */



More information about the drbd-cvs mailing list