[DRBD-user] error (device drbd0): ext3_free_blocks: bit already cleared

Lars Ellenberg Lars.Ellenberg at linbit.com
Wed May 19 17:13:10 CEST 2004

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


/ 2004-05-19 18:40:20 +0400
\ Eugene Crosser:
> On Wed, 2004-05-19 at 18:28, Lars Ellenberg wrote:
> 
> > > > but it is the brutal solution, so IO may hang for some seconds while the
> > > > connection handshake is done... and it is not even strictly correct, since
> > > > theoretically there still is a race :(
> > > 
> > > In cvs checkouted around 15:30 today, things did not change to good.
> > 
> > not to bad either, I hope?
> 
> Nope, the same, apparently.  Syncsource stays in "100.0%" state as it
> did before.

please try this patch, I'd like to see if that has some impact
before I do a check in.

Thanks,
	Lars


Index: drbd_main.c
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_main.c,v
retrieving revision 1.73.2.177
diff -u -p -r1.73.2.177 drbd_main.c
--- drbd_main.c	18 May 2004 16:20:42 -0000	1.73.2.177
+++ drbd_main.c	19 May 2004 15:15:20 -0000
@@ -680,7 +680,7 @@ int drbd_send_param(drbd_dev *mdev, int 
 }
 
 /* See the comment at receive_bitmap() */
-int drbd_send_bitmap(drbd_dev *mdev)
+int _drbd_send_bitmap(drbd_dev *mdev)
 {
 	int buf_i,want;
 	int ok=TRUE, bm_i=0;
@@ -703,10 +703,20 @@ int drbd_send_bitmap(drbd_dev *mdev)
 		want=min_t(int,MBDS_PACKET_SIZE,(bm_words-bm_i)*sizeof(long));
 		for(buf_i=0;buf_i<want/sizeof(long);buf_i++)
 			buffer[buf_i] = cpu_to_lel(bm[bm_i++]);
-		ok = drbd_send_cmd(mdev,mdev->data.socket,ReportBitMap,
-				   p, sizeof(*p) + want);
+		ok = _drbd_send_cmd(mdev,mdev->data.socket,ReportBitMap,
+				   p, sizeof(*p) + want, 0);
 	} while (ok && want);
+
 	vfree(p);
+	return ok;
+}
+
+int drbd_send_bitmap(drbd_dev *mdev)
+{
+	int ok;
+	down(&mdev->data.mutex);
+	ok=_drbd_send_bitmap(mdev);
+	up(&mdev->data.mutex);
 	return ok;
 }
 
Index: drbd_receiver.c
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_receiver.c,v
retrieving revision 1.97.2.159
diff -u -p -r1.97.2.159 drbd_receiver.c
--- drbd_receiver.c	18 May 2004 22:06:55 -0000	1.97.2.159
+++ drbd_receiver.c	19 May 2004 15:15:22 -0000
@@ -1247,8 +1247,21 @@ STATIC int receive_param(drbd_dev *mdev,
 
 		if( sync ) {
 			if(have_good == 1) {
-				drbd_send_bitmap(mdev);
+				/*
+				 * receiver expects the whole bitmap in one go.
+				 * so get the data.mutex here.
+				 * set_cstate within the mutex to avoid a race
+				 * between up() and the
+				 * wait_event(cstate != WFBitMap*) condition
+				 * above.
+				 */
+				down(&mdev->data.mutex);
 				set_cstate(mdev,WFBitMapS);
+				/* FIXME, here we actually have to wait for
+				 * ap_bio_cnt == 0 and/or local_cnt == 0
+				 */
+				_drbd_send_bitmap(mdev);
+				up(&mdev->data.mutex);
 			} else { // have_good == -1
 				if ( (mdev->state == Primary) &&
 				     (mdev->gen_cnt[Flags] & MDF_Consistent) ) {
Index: linux/drbd_config.h
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/linux/Attic/drbd_config.h,v
retrieving revision 1.1.2.6
diff -u -p -r1.1.2.6 drbd_config.h
--- linux/drbd_config.h	19 May 2004 10:03:59 -0000	1.1.2.6
+++ linux/drbd_config.h	19 May 2004 15:15:22 -0000
@@ -30,7 +30,7 @@
 //#define DBG_SPINLOCKS   // enables MUST_HOLD macro (assertions for spinlocks)
 //#define DBG_ASSERTS     // drbd_assert_breakpoint() function
 //#define DUMP_MD 1       // Dump metadata to syslog upon connect
-//#define DUMP_MD 2       // Dump even all cstate changes
+#define DUMP_MD 2       // Dump even all cstate changes
 
 //#define SIGHAND_HACK           // Needed for RH 2.4.20 and later kernels.
 //#define REDHAT_HLIST_BACKPORT  // Makes DRBD work on RH9 kernels



More information about the drbd-user mailing list