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

svn at svn.drbd.org svn at svn.drbd.org
Mon Nov 29 12:15:52 CET 2004


Author: phil
Date: 2004-11-29 12:15:50 +0100 (Mon, 29 Nov 2004)
New Revision: 1661

Modified:
   branches/drbd-0.7/drbd/Makefile-2.6
   branches/drbd-0.7/drbd/drbd_receiver.c
Log:
Removed the "struct list_head *head" parameter from 
the drbd_process_ee() function, added a "be_sleepy"
flag argument. 

This this flag, the asender we avoid that the asender
thread eventually sleeps in drbd_process_ee().

This changes makes a strange lockup condition go
away... where receive and asender where sleeping
in drbd_process_ee(). 

I do not know exacle how the lockup begins, but
with this changes it can not lock-up.



Modified: branches/drbd-0.7/drbd/Makefile-2.6
===================================================================
--- branches/drbd-0.7/drbd/Makefile-2.6	2004-11-29 08:46:01 UTC (rev 1660)
+++ branches/drbd-0.7/drbd/Makefile-2.6	2004-11-29 11:15:50 UTC (rev 1661)
@@ -1,4 +1,4 @@
-CFLAGS_drbd_sizeof_sanity_check.o = -Wpadded # -Werror
+#CFLAGS_drbd_sizeof_sanity_check.o = -Wpadded # -Werror
 
 drbd-objs  :=	drbd_sizeof_sanity_check.o \
 		drbd_buildtag.o drbd_bitmap.o drbd_fs.o drbd_proc.o \

Modified: branches/drbd-0.7/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_receiver.c	2004-11-29 08:46:01 UTC (rev 1660)
+++ branches/drbd-0.7/drbd/drbd_receiver.c	2004-11-29 11:15:50 UTC (rev 1661)
@@ -243,7 +243,7 @@
 #define GFP_TRY	( __GFP_HIGHMEM )
 #endif
 
-STATIC int _drbd_process_ee(drbd_dev *mdev,struct list_head *head);
+STATIC int _drbd_process_ee(drbd_dev *mdev, int be_sleepy);
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 STATIC void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state)
@@ -297,7 +297,7 @@
 		spin_lock_irq(&mdev->ee_lock);
 	}
 
-	if(list_empty(&mdev->free_ee)) _drbd_process_ee(mdev,&mdev->done_ee);
+	if(list_empty(&mdev->free_ee)) _drbd_process_ee(mdev,1);
 
 	if(list_empty(&mdev->free_ee)) {
 		for (;;) {
@@ -322,7 +322,7 @@
 			}
 			// finish wait is inside, so that we are TASK_RUNNING 
 			// in _drbd_process_ee (which might sleep by itself.)
-			_drbd_process_ee(mdev,&mdev->done_ee);
+			_drbd_process_ee(mdev,1);
 		}
 		finish_wait(&mdev->ee_wait, &wait); 
 	}
@@ -393,9 +393,10 @@
    from this function. Note, this function is called from all three
    threads (receiver, worker and asender). To ensure this I only allow
    one thread at a time in the body of the function */
-STATIC int _drbd_process_ee(drbd_dev *mdev,struct list_head *head)
+STATIC int _drbd_process_ee(drbd_dev *mdev, int be_sleepy)
 {
 	struct Tl_epoch_entry *e;
+	struct list_head *head = &mdev->done_ee;
 	struct list_head *le;
 	int ok=1;
 	int got_sig;
@@ -405,6 +406,10 @@
 	reclaim_net_ee(mdev);
 
 	if( test_and_set_bit(PROCESS_EE_RUNNING,&mdev->flags) ) {
+		if(!be_sleepy) {
+			clear_bit(PROCESS_EE_RUNNING,&mdev->flags);
+			return 3;
+		}
 		spin_unlock_irq(&mdev->ee_lock);
 		got_sig = wait_event_interruptible(mdev->ee_wait,
 		       test_and_set_bit(PROCESS_EE_RUNNING,&mdev->flags) == 0);
@@ -428,11 +433,11 @@
 	return ok;
 }
 
-STATIC int drbd_process_ee(drbd_dev *mdev,struct list_head *head)
+STATIC int drbd_process_ee(drbd_dev *mdev, int be_sleepy)
 {
 	int rv;
 	spin_lock_irq(&mdev->ee_lock);
-	rv=_drbd_process_ee(mdev,head);
+	rv=_drbd_process_ee(mdev,be_sleepy);
 	spin_unlock_irq(&mdev->ee_lock);
 	return rv;
 }
@@ -803,7 +808,7 @@
 	drbd_wait_ee(mdev,&mdev->active_ee);
 
 	spin_lock_irq(&mdev->ee_lock);
-	rv = _drbd_process_ee(mdev,&mdev->done_ee);
+	rv = _drbd_process_ee(mdev,1);
 
 	epoch_size=mdev->epoch_size;
 	mdev->epoch_size=0;
@@ -2194,7 +2199,7 @@
 		 */
 		set_bit(SIGNAL_ASENDER, &mdev->flags);
 
-		if (!drbd_process_ee(mdev,&mdev->done_ee)) goto err;
+		if (!drbd_process_ee(mdev,0)) goto err;
 
 		rv = drbd_recv_short(mdev,buf,expect-received);
 		clear_bit(SIGNAL_ASENDER, &mdev->flags);



More information about the drbd-cvs mailing list