[DRBD-cvs] r1671 - branches/drbd-0.7/drbd

svn at svn.drbd.org svn at svn.drbd.org
Thu Dec 9 15:01:41 CET 2004


Author: phil
Date: 2004-12-09 15:01:39 +0100 (Thu, 09 Dec 2004)
New Revision: 1671

Modified:
   branches/drbd-0.7/drbd/drbd_int.h
   branches/drbd-0.7/drbd/drbd_main.c
   branches/drbd-0.7/drbd/drbd_receiver.c
   branches/drbd-0.7/drbd/drbd_worker.c
Log:
There was a race condition between attaching a device to its disk
and the starting of resync in receive_SyncParam(). 

This race caused the syncer to hit a BUG() macro in
mod_timer().

Fixed it.


Modified: branches/drbd-0.7/drbd/drbd_int.h
===================================================================
--- branches/drbd-0.7/drbd/drbd_int.h	2004-12-07 10:54:35 UTC (rev 1670)
+++ branches/drbd-0.7/drbd/drbd_int.h	2004-12-09 14:01:39 UTC (rev 1671)
@@ -1039,7 +1039,7 @@
 extern int drbd_ioctl(struct inode *inode, struct file *file,
 		      unsigned int cmd, unsigned long arg);
 
-// drbd_dsender.c
+// drbd_worker.c
 extern int drbd_worker(struct Drbd_thread *thi);
 extern void drbd_alter_sg(drbd_dev *mdev, int ng);
 extern void drbd_start_resync(drbd_dev *mdev, Drbd_CState side);
@@ -1058,6 +1058,7 @@
 extern int w_try_send_barrier    (drbd_dev *, struct drbd_work *, int);
 extern int w_send_write_hint     (drbd_dev *, struct drbd_work *, int);
 extern int w_make_resync_request (drbd_dev *, struct drbd_work *, int);
+extern void resync_timer_fn(unsigned long data);
 
 // drbd_receiver.c
 extern int drbd_release_ee(drbd_dev* mdev,struct list_head* list);

Modified: branches/drbd-0.7/drbd/drbd_main.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_main.c	2004-12-07 10:54:35 UTC (rev 1670)
+++ branches/drbd-0.7/drbd/drbd_main.c	2004-12-09 14:01:39 UTC (rev 1671)
@@ -1385,6 +1385,8 @@
 	mdev->barrier_work.cb = w_try_send_barrier;
 	mdev->unplug_work.cb  = w_send_write_hint;
 	init_timer(&mdev->resync_timer);
+	mdev->resync_timer.function = resync_timer_fn;
+	mdev->resync_timer.data = (unsigned long) mdev;
 
 	init_waitqueue_head(&mdev->cstate_wait);
 	init_waitqueue_head(&mdev->ee_wait);

Modified: branches/drbd-0.7/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_receiver.c	2004-12-07 10:54:35 UTC (rev 1670)
+++ branches/drbd-0.7/drbd/drbd_receiver.c	2004-12-09 14:01:39 UTC (rev 1671)
@@ -1431,6 +1431,8 @@
 	consider_sync = (mdev->cstate == WFReportParams);
 	if(drbd_determin_dev_size(mdev)) consider_sync=0;
 
+	if(test_bit(DISKLESS, &mdev->flags)) consider_sync=0;
+
 	drbd_bm_unlock(mdev); // }
 
 	if(be32_to_cpu(p->flags)&1) {

Modified: branches/drbd-0.7/drbd/drbd_worker.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_worker.c	2004-12-07 10:54:35 UTC (rev 1670)
+++ branches/drbd-0.7/drbd/drbd_worker.c	2004-12-09 14:01:39 UTC (rev 1671)
@@ -929,9 +929,6 @@
 
 	sprintf(current->comm, "drbd%d_worker", (int)(mdev-drbd_conf));
 
-	mdev->resync_timer.function = resync_timer_fn;
-	mdev->resync_timer.data = (unsigned long) mdev;
-
 	for (;;) {
 		intr = down_interruptible(&mdev->data.work.s);
 



More information about the drbd-cvs mailing list