[DRBD-cvs] DRBD CVS: drbd by phil from

drbd-cvs@linbit.com drbd-cvs@linbit.com
Tue, 13 Jan 2004 12:06:29 +0100 (CET)


DRBD CVS committal

Author  : phil
Host    : 
Module  : drbd

Dir     : drbd/drbd


Modified Files:
      Tag: rel-0_7-branch
	drbd_actlog.c 


Log Message:
* The resync LRU should never be marked as dirty. (Exception: It is
  actually marked as dirty, but while the lock is held)
* Fixed wrong locking in _al_not_in_use()

===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/Attic/drbd_actlog.c,v
retrieving revision 1.1.2.48
retrieving revision 1.1.2.49
diff -u -3 -r1.1.2.48 -r1.1.2.49
--- drbd_actlog.c	12 Jan 2004 19:49:41 -0000	1.1.2.48
+++ drbd_actlog.c	13 Jan 2004 11:06:29 -0000	1.1.2.49
@@ -67,12 +67,6 @@
 		}
 	}
 	al_ext   = lc_get(mdev->act_log,enr);
-	if(al_ext) {
-		if (al_ext->lc_number != enr) {
-			if (!lc_try_lock(mdev->resync))
-				BUG(); // has to be successfull
-		}
-	}
 	al_flags = mdev->act_log->flags;
 	spin_unlock_irq(&mdev->al_lock);
 
@@ -109,7 +103,6 @@
 		spin_lock_irq(&mdev->al_lock);
 		lc_changed(mdev->act_log,al_ext);
 		spin_unlock_irq(&mdev->al_lock);
-		lc_unlock(mdev->resync);
 		wake_up(&mdev->al_wait);
 	}
 }
@@ -532,7 +525,8 @@
 		}
 		lc_put(mdev->resync,(struct lc_element*)ext);
 	} else {
-		ERR("lc_get(rsync) failed ?!?\n");
+		ERR("lc_get() failed! Probabely something stays"
+		    " dirty in the on disk BM\n");
 	}
 	spin_unlock_irqrestore(&mdev->al_lock,flags);
 
@@ -627,17 +621,17 @@
 static inline int _al_not_in_use(drbd_dev* mdev, unsigned int enr)
 {
 	struct lc_element* al_ext;
-
+	int rv=0;
+	
 	spin_lock_irq(&mdev->al_lock);
 	al_ext = lc_find(mdev->act_log,enr);
+	if(al_ext == 0 ) rv = 1;
+	else if(al_ext->refcnt == 0) rv = 1;
 	spin_unlock_irq(&mdev->al_lock);
 
-	if(al_ext == 0) return 1;
-	if(al_ext->refcnt == 0) return 1;
+	if(!rv) WARN("Delaying sync read until app's write is done\n");
 
-	WARN("Delaying sync read until app's write is done\n");
-
-	return 0;
+	return rv;
 }
 
 /**