Re: PATCH: tty locking for 2.6.9rc2

Paul Fulghum
2004-09-15T16:30:51Z

On Tue, 2004-09-14 at 11:34, Alan Cox wrote:
> This updates the ldisc locking patch for the 2.6.9rc2 changes.

I tried this patch and can't change line disciplines.
The user program waits forever on ioctl(TIOCSETD).
I am going to add printk statements to
find out more.

Looking at your patch I have a question:

Each line discipline has a refcount.
This single refcount is modified by all
entities using that line discipline.

tty_set_ldisc() in tty_io.c waits until the
old ldisc refcount goes to zero before setting
the new ldisc. This seems to cause a problem
in the following situation:

1. two tty instances start with the same ldisc
2. first tty instance holds reference to ldisc
3. second tty instance tries to change ldisc

The second tty instance must wait for the first
tty instance to drop the ldisc reference before
it can change to a new ldisc.

Each tty instance should be able to change
line discipline independant of other tty instances.

Or am I not understanding this correctly?

--
Paul Fulghum
paulkf@microgate.com