Hi Greg, hi list,

quoting Linus:

--
> so there is no need to recheck the bit in do/while loop, because
> there is no false wakeups now.

You should never assume this. You should assume that there are _always_
false wakeups.

Why? Because Linux has always allowed people to leave wait-queues active,
without being "atomic". For example, the tty read/write layer used to
(still does?)  add itself on the wait-queue _once_, and then leave itself
on the wait-queue while in a loop it does copies from/to user space.
--

Unfortunately, this means us. Here's the first fix. Comments?

        Regards
                Oliver


You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.

===================================================================


[EMAIL PROTECTED], 2004-05-11 23:29:13+02:00, [EMAIL PROTECTED]
  - make sure timeouts are observed even if somebody left us on a queue


 mdc800.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)


diff -Nru a/drivers/usb/image/mdc800.c b/drivers/usb/image/mdc800.c
--- a/drivers/usb/image/mdc800.c        Tue May 11 23:37:35 2004
+++ b/drivers/usb/image/mdc800.c        Tue May 11 23:37:35 2004
@@ -319,7 +319,9 @@
        set_current_state(TASK_INTERRUPTIBLE);
        if (!mdc800->irq_woken)
        {
-               schedule_timeout (msec*HZ/1000);
+               long timeout = msec*HZ/1000;
+               while(timeout)
+                       timeout = schedule_timeout (timeout);
        }
         remove_wait_queue(&mdc800->irq_wait, &wait);
        set_current_state(TASK_RUNNING);
@@ -718,7 +720,9 @@
                                set_current_state(TASK_INTERRUPTIBLE);
                                if (!mdc800->downloaded)
                                {
-                                       schedule_timeout 
(TO_DOWNLOAD_GET_READY*HZ/1000);
+                                       long timeout = TO_DOWNLOAD_GET_READY*HZ/1000;
+                                       while(timeout)
+                                               timeout = schedule_timeout (timeout);
                                }
                                set_current_state(TASK_RUNNING);
                                remove_wait_queue(&mdc800->download_wait, &wait);
@@ -842,7 +846,9 @@
                        set_current_state(TASK_INTERRUPTIBLE);
                        if (!mdc800->written)
                        {
-                               schedule_timeout (TO_WRITE_GET_READY*HZ/1000);
+                               long timeout = TO_WRITE_GET_READY*HZ/1000;
+                               while(timeout)
+                                       timeout = schedule_timeout (timeout);
                        }
                         set_current_state(TASK_RUNNING);
                        remove_wait_queue(&mdc800->write_wait, &wait);

===================================================================


This BitKeeper patch contains the following changesets:
1.1627
## Wrapped with gzip_uu ##


begin 664 bkpatch7565
M'XL(`)]'H4```[54;4_;,!#^'/^*D_BR#36Q'>>%HDYEM`(TM**N"&T(56YR
M;2.2&.*D'5)^_)PR"A6O0UL2R?+=^9[G[AYG"TXU%FU+I<D""[(%ATJ79HNY
MRM&>JPS3)*]^V:J8&>=0*>-T&K.CTC3ASJA`U$X3H[E'3,B)+*,YF%RZ;3';
M75O*FRML6\/^P>GQWI"[EMAIL PROTECTED]<LH=,AI2H6,HUU5Y;S5.5V6<A<9UA*
M.U)9O0ZM.:7<O!X+7.KY-?.I".J(Q8Q)P3"F7(2^(#/$HNRNF+<R/[QLZ)_?
M05QLIA,F&6/"$RZMN4?#@/2`V<SG`5#A4,]A#+C;YCMMYFY3WJ84;IO5?:I)
ML,[EMAIL PROTECTED]<D7^+<%[9,(6I#)2P1=%0AEDJ&[EMAIL PROTECTED];-3$C'"!,>`"<TBFH`VCB8IO
M(,5I"94&E8.$ZPHK)%^!BX!S<G+??]+ZRX<0*BGY_$J-<=%T23N5GCA9'(64
MVM&#<@5E0>T+U_?J&,.I]"<LBN,@\GWQ4H,WTB:9G.%&\M4T.>.AQVLW%(RO
MI/;\F=>U]_XRB"ZQR+N%6J8RC^VY-#!%;&-<G<\*G%V\6HK+*&=",*_FPO?$
M2IBNMRG+L.WQM\AR!UKN_Y%EM#H$2YD8/98*EO,D14B5NM)&;;=#&$"K6*X^
MHYZ3%^;Q#BWV7,Z!D:-F<8EEF;)F=Q<$.I!IC#X=_G08I737N%?T/OSQ?S0&
MZSY61W,SG13'=Z9UW"[I!9PU,,W2P%B/D$:#<6]P]NUXL-<;'_1'XV%_K_?C
M(;3U%/K;"83":[EMAIL PROTECTED])764=,)[EMAIL PROTECTED]"_
)`:6?&[EMAIL PROTECTED]
`
end


-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to 
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to