Oliver Neukum wrote:
> Am Dienstag, 27. Juni 2006 16:09 schrieb Franck Bui-Huu:
>> Oliver Neukum wrote:
>>> Am Dienstag, 27. Juni 2006 09:52 schrieb Franck Bui-Huu:
>>>> +       expire = timeout ? msecs_to_jiffies(timeout) : 
>>>> MAX_SCHEDULE_TIMEOUT;
>>>> +       if (!wait_for_completion_timeout(&done, expire)) {
>>>> +               usb_unlink_urb(urb);
>>>>         }
>>>> -
>>>> +       status = urb->status;
>>> Hm, is this racy?
>>> What happens if usb_unlink_urb() and the completion handler race?
>>> If usb_unlink_urb() fails to unlink the URB because it is too late,
>>> is it guaranteed that urb->status is valid?
>>> In the old version this could not happen because the completion was
>>> always done.
>> well, I'm not sure to understand. Do you mean "what happen if the timeout has
>> expired, but just before calling usb_unlink_urb() the urb is completed by the
>> hcd" ?
>>
>> If so, I think that usb_unlink_urb() handles this case by checking (with lock
>> held) that the urb is still queued.
> 
> Precisely. If the URB is not queued it'll notice. But you read urb->status
> even in that case.
> 

If URB is no more queued when calling usb_unlink_urb(), this function will leave
urb->status alone. So urb->status will have the value given by the hcd. 
Therefore
usb_start_wait_urb() will behave like a normal case (no timeout). I don't see
what's wrong here...

                Franck

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to