[DRBD-user] DRBD 0.7-pre8 Kernel 2.4.X oops problem

Philipp Reisner philipp.reisner at linbit.com
Wed Jun 30 10:37:05 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.


On Tuesday 29 June 2004 13:41, Lars Ellenberg wrote:
> On Tue, Jun 29, 2004 at 12:34:44AM +0200, Lars Ellenberg wrote:
> > as someone else already pointed out:
> > our definitions for the DEFINE_WAIT marco, as well as the
> > prepare_to_wait and _finish_wait functions, are the problem here.
> >
> >
> > DEFINE_WAIT is maped to DECLARE_WAIT, which initializes
> > w.task_list.{prev,next} == NULL, thus list_empty(&wait->task_list) is
> > false, and the wait thingy is never added to the list in
> > prepare_to_wait --- but it is removed later in finish_wait, where the
> > NULL dereference happens.
> >
> > in 2.6 this problem does not occur,
> > since there "list_empty_careful" is used...
> >
> >
> > anyways, this should help
> > (untested...  I'm not at my own work place,
> > and currently I can not even do a test compile ...)
> >
> > 	lge
> >
> > Index: drbd_receiver.c
> > ===================================================================
> > RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_receiver.c,v
> > retrieving revision 1.97.2.175
> > diff -u -p -r1.97.2.175 drbd_receiver.c
> > --- drbd_receiver.c	26 Jun 2004 08:05:40 -0000	1.97.2.175
> > +++ drbd_receiver.c	28 Jun 2004 22:20:14 -0000
> > @@ -267,7 +267,10 @@ STATIC void finish_wait(wait_queue_head_
> >  	spin_unlock_irqrestore(&q->lock, flags);
> >  }
> >
> > -#define DEFINE_WAIT(name)	DECLARE_WAITQUEUE(name,current)
> > +#define DEFINE_WAIT(name)	do {	\
> > +	DECLARE_WAITQUEUE(name,current);\
> > +	list_init(&name.task_list);	\
> > +} while (0)
> >
> >  #endif
>
> nonsense, obviously the "DECLARE" would be valid only in the do {} block
> scope. it has been very late, this morning...
>
> correct patch will follow soonish...
>

I have committed this to CVS...

RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_receiver.c,v
retrieving revision 1.97.2.175
retrieving revision 1.97.2.176
diff -u -r1.97.2.175 -r1.97.2.176
--- drbd_receiver.c     26 Jun 2004 08:05:40 -0000      1.97.2.175
+++ drbd_receiver.c     30 Jun 2004 08:34:50 -0000      1.97.2.176
@@ -267,7 +267,13 @@
        spin_unlock_irqrestore(&q->lock, flags);
 }

-#define DEFINE_WAIT(name)      DECLARE_WAITQUEUE(name,current)
+#define DEFINE_WAIT(name)                                              \
+       wait_queue_t name = {                                           \
+               .task           = current,                              \
+               .task_list      = {     .next = &name.task_list,        \
+                                       .prev = &name.task_list,        \
+                               },                                      \
+       }

 #endif

-Philipp
-- 
: Dipl-Ing Philipp Reisner                      Tel +43-1-8178292-50 :
: LINBIT Information Technologies GmbH          Fax +43-1-8178292-82 :
: Schönbrunnerstr 244, 1120 Vienna, Austria    http://www.linbit.com :



More information about the drbd-user mailing list