[DRBD-cvs] drbd by phil; Well, the problem was that if we got the...

drbd-user@lists.linbit.com drbd-user@lists.linbit.com
Fri, 19 Mar 2004 12:29:49 +0100 (CET)


DRBD CVS committal

Author  : phil
Module  : drbd

Dir     : drbd/drbd


Modified Files:
      Tag: rel-0_7-branch
	drbd_receiver.c 


Log Message:
Well, the problem was that if we got the bit _AND_ a signal
became pending. With the previous code we aborted the
function but did not release the bit.
->
Subsequent calls also from other threads will deadlock forever
on test_and_set_bit(PROCESS_EE_RUNNING)

I think this fixes this. 

===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_receiver.c,v
retrieving revision 1.97.2.124
retrieving revision 1.97.2.125
diff -u -3 -r1.97.2.124 -r1.97.2.125
--- drbd_receiver.c	14 Mar 2004 19:32:47 -0000	1.97.2.124
+++ drbd_receiver.c	19 Mar 2004 11:29:43 -0000	1.97.2.125
@@ -318,15 +318,16 @@
 	struct Tl_epoch_entry *e;
 	struct list_head *le;
 	int ok=1;
+	int got_sig;
 
 	MUST_HOLD(&mdev->ee_lock);
 
 	if( test_and_set_bit(PROCESS_EE_RUNNING,&mdev->flags) ) {
 		spin_unlock_irq(&mdev->ee_lock);
-		wait_event_interruptible(mdev->ee_wait, 
+		got_sig = wait_event_interruptible(mdev->ee_wait, 
 		       test_and_set_bit(PROCESS_EE_RUNNING,&mdev->flags) == 0);
 		spin_lock_irq(&mdev->ee_lock);
-		if(signal_pending(current)) return 2;
+		if(got_sig) return 2;
 	}
 
 	while(!list_empty(head)) {