[DRBD-cvs] svn commit by phil - r2447 - trunk/drbd - With the commit 2436:2436 I changed the drbd_try_clear_

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Fri Sep 22 14:35:07 CEST 2006


Author: phil
Date: 2006-09-22 14:35:05 +0200 (Fri, 22 Sep 2006)
New Revision: 2447

Modified:
   trunk/drbd/drbd_actlog.c
   trunk/drbd/drbd_int.h
   trunk/drbd/drbd_worker.c
Log:
With the commit 2436:2436 I changed the drbd_try_clear_on_disk_bm()
function to not remove etnries form the resync LRU when the rs_left
member reaches zero.

But when the resync is finished we need to remove all entries form 
the resync LRU, otherwise a subsequent resync run might find the
old entries in the cache! And the rl_lest of these old entries
would wrong then.


Modified: trunk/drbd/drbd_actlog.c
===================================================================
--- trunk/drbd/drbd_actlog.c	2006-09-22 12:11:59 UTC (rev 2446)
+++ trunk/drbd/drbd_actlog.c	2006-09-22 12:35:05 UTC (rev 2447)
@@ -960,3 +960,29 @@
 	spin_unlock_irq(&mdev->al_lock);
 	wake_up(&mdev->al_wait);
 }
+
+/**
+ * drbd_rs_del_all: Gracefully remove all extents from the resync LRU.
+ */
+void drbd_rs_del_all(drbd_dev* mdev)
+{
+	struct bm_extent* bm_ext;
+	int i;
+
+	spin_lock_irq(&mdev->al_lock);
+
+	if(inc_local_if_state(mdev,Failed)) { // Makes sure ->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;
+			D_ASSERT(bm_ext->lce.refcnt == 0);
+			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));
+			lc_del(mdev->resync,&bm_ext->lce);
+		}
+		D_ASSERT(mdev->resync->used==0);
+		dec_local(mdev);
+	}
+	spin_unlock_irq(&mdev->al_lock);
+}

Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h	2006-09-22 12:11:59 UTC (rev 2446)
+++ trunk/drbd/drbd_int.h	2006-09-22 12:35:05 UTC (rev 2447)
@@ -1272,6 +1272,7 @@
 extern void drbd_rs_complete_io(struct Drbd_Conf *mdev, sector_t sector);
 extern int drbd_rs_begin_io(struct Drbd_Conf *mdev, sector_t sector);
 extern void drbd_rs_cancel_all(drbd_dev* mdev);
+extern void drbd_rs_del_all(drbd_dev* mdev);
 extern int drbd_al_read_log(struct Drbd_Conf *mdev,struct drbd_backing_dev *);
 extern void __drbd_set_in_sync(drbd_dev* mdev, sector_t sector, int size, const char* file, const unsigned int line);
 #define drbd_set_in_sync(mdev,sector,size) \

Modified: trunk/drbd/drbd_worker.c
===================================================================
--- trunk/drbd/drbd_worker.c	2006-09-22 12:11:59 UTC (rev 2446)
+++ trunk/drbd/drbd_worker.c	2006-09-22 12:35:05 UTC (rev 2447)
@@ -410,6 +410,11 @@
 
 	drbd_uuid_set_bm(mdev,0UL);
 
+	// Remove all elements form the resync LRU. Since future actions
+	// might set bits in the (main) bitmap, then the entries in the 
+	// resync LRU would be wrong.
+	drbd_rs_del_all(mdev);
+
 	if ( mdev->p_uuid ) {
 		kfree(mdev->p_uuid);
 		mdev->p_uuid = NULL;



More information about the drbd-cvs mailing list