[DRBD-cvs] svn commit by phil - r3004 - branches/drbd-8.0/drbd - Fixed a bug that was introduced with 8.0.1 (r2737). In

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Wed Aug 1 16:26:13 CEST 2007


Author: phil
Date: 2007-08-01 16:26:12 +0200 (Wed, 01 Aug 2007)
New Revision: 3004

Modified:
   branches/drbd-8.0/drbd/drbd_worker.c
Log:
Fixed a bug that was introduced with 8.0.1 (r2737). In case you slowed
down the resync speed during a running resync process considerabely, you
could trigger a bug in w_make_resync_request(), that causes the local_cnt 
to go below zero.

When the number of requests that should be on the fly for the new
(lower) resync speed is higher than the number of requests that are 
currently on the fly, we had that "goto requeue:". In the exit path of 
the function we decreased the local_cnt by one...



Modified: branches/drbd-8.0/drbd/drbd_worker.c
===================================================================
--- branches/drbd-8.0/drbd/drbd_worker.c	2007-07-27 13:07:19 UTC (rev 3003)
+++ branches/drbd-8.0/drbd/drbd_worker.c	2007-08-01 14:26:12 UTC (rev 3004)
@@ -325,13 +325,6 @@
 		ERR("%s in w_make_resync_request\n", conns_to_name(mdev->state.conn));
 	}
 
-        number = SLEEP_TIME*mdev->sync_conf.rate / ((BM_BLOCK_SIZE/1024)*HZ);
-
-	if (atomic_read(&mdev->rs_pending_cnt)>number) {
-		goto requeue;
-	}
-	number -= atomic_read(&mdev->rs_pending_cnt);
-
 	if(!inc_local(mdev)) {
 		/* Since we only need to access mdev->rsync a
 		   inc_local_if_state(mdev,Failed) would be sufficient, but
@@ -341,7 +334,15 @@
 		mdev->resync_work.cb = w_resync_inactive;
 		return 1;
 	}
+	/* All goto requeses have to happend after this block: inc_local() */
 
+	number = SLEEP_TIME*mdev->sync_conf.rate / ((BM_BLOCK_SIZE/1024)*HZ);
+
+	if (atomic_read(&mdev->rs_pending_cnt)>number) {
+		goto requeue;
+	}
+	number -= atomic_read(&mdev->rs_pending_cnt);
+
 	for(i=0;i<number;i++) {
 
 	next_sector:



More information about the drbd-cvs mailing list