Re: [PATCH v3 03/23] n_tty: Don't flush buffer when closing ldisc

From: Jiri Slaby
Date: Thu Feb 07 2013 - 09:57:41 EST


On 02/05/2013 09:20 PM, Peter Hurley wrote:
> A buffer flush is both undesirable and unnecessary when the ldisc
> is closing. A buffer flush performs the following:
> 1. resets ldisc data fields to their initial state
> 2. resets tty->receive_room to indicate more data can be sent
> 3. schedules buffer work to receive more data
> 4. signals a buffer flush has happened to linked pty in packet mode
>
> Since the ldisc has been halted and the tty may soon be destructed,
> buffer work must not be scheduled as that work might access
> an invalid tty and ldisc state. Also, the ldisc read buffer is about
> to be freed, so that's pointless.
>
> Resetting the ldisc data fields is pointless as well since that
> structure is about to be freed.
>
> Resetting tty->receive_room is unnecessary, as it will be properly
> reset if a new ldisc is reopened. Besides, resetting the original
> receive_room value would be wrong since the read buffer will be
> gone.
>
> Since the packet mode flush is observable from userspace, this
> behavior has been preserved.

This one looks good to me.

--
js
suse labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/