> On Jan 2, 2019, at 7:04 AM, Tetsuo Handa <penguin-ker...@i-love.sakura.ne.jp> 
> wrote:
> 
> On 2019/01/01 12:11, Paul Fulghum wrote:
>> NAK to this patch. It causes lost wakeups in both read and write paths.
>> 
>> The write path does not need changing.
>> 
>> The read path can be fixed by setting current to TASK_RUNNING at the top of 
>> the if (rbuf) block
>> so the warning is not triggered by copy_to_user(). If this block runs the 
>> condition is satisfied
>> and it breaks out of the polling loop where it is already being set to 
>> TASK_RUNNING and removed
>> from the wait queue. This particular path just needs to account for the 
>> copy_to_user which occurs
>> before breaking out.
>> 
>> I’ll make a patch to do this when I have the ability to test it in a day or 
>> two.
>> 
> 
> OK. Then, any chance it is rewritten using wait_event_interruptible() in 
> order to reduce lines?
> ( wait_event_interruptible() automatically calls might_sleep(), but is it 
> acceptable for you? )
> 

This looks good to me. I applied it and tested blocking (sleep/no sleep) and 
non-blocking (success/EAGAIN) paths for both read and write.

Reply via email to