Re: [PATCH 5/6] n_tty: Fix stuck write wakeup

Johannes Stezenbach
2015-12-13T19:27:52Z

On Sun, Dec 13, 2015 at 10:38:02AM -0800, Peter Hurley wrote:
> On 12/13/2015 07:18 AM, Johannes Stezenbach wrote:
> >
> > There is a related bug that I meant to send a patch, but I
> > never got around because the issue was found with proprietary
> > userspace and ancient kernel. Maybe you could take care of it?
> > The patch might not apply cleanly after your recent changes
> > or might even be invalid now, please check.
>
> Thanks for the patch, Johannes!
>
> Yes, the patch below is still required to prevent excessive SIGIO
> (and to prevent missed SIGIO when the amount actually copied just
> happens to be exactly the amount left to be copied).
>
> I made some comments in the patch; can you re-submit with those
> changes and the patch title in the subject? Or I'd happy to re-work
> it and send it to Greg if you'd prefer; just let me know.

Please rework it, currently I'm in lazy bum mode ;-)

> > @@ -1991,7 +1992,7 @@ static ssize_t n_tty_write(struct tty_st
> > break_out:
> > __set_current_state(TASK_RUNNING);
> > remove_wait_queue(&tty->write_wait, &wait);
> > - if (b - buf != nr && tty->fasync)
> > + if (b - buf != count && tty->fasync)
>
> ... this can be
>
> if (nr && tty->fasync)
> set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);

Yeah, that's way better.

Thanks,
Johannes