Re: [PATCH] tty races

From: Jason Baron
Date: Tue May 03 2005 - 20:15:25 EST



On Tue, 3 May 2005, Andrew Morton wrote:

> > > We want to move away from lock_kernel()-based locking.
> > >
> >
> > I completely agree, but unfortunately lock_kernel() is currently used
> > extensively throughout the tty layer.
>
> Well no - it's being migrated over to use tty_sem. We shouldn't start
> heading in the reverse direction. Plus your patch reverts part of
> http://linux.bkbits.net:8080/linux-2.5/diffs/drivers/char/tty_io.c@xxxxx?nav=index.html|src/|src/drivers|src/drivers/char|hist/drivers/char/tty_io.c
> in ways which might be unsafe.
>

The patch I proposed does not add any lock_kernel() based locking. The
only locking it adds is more tty_sem based locking to cover the
driver->open() method. I agree though that it relies on the BKL for
correctness.

Indeed, that is precisely that patch which introduced the problems I've
pointed out.

> > lock_kernel() is used extensively throughout the tty layer. We can
> > re-write the locking for the layer, but I'd like to see this bug fix in
> > 2.6.12, if that isn't done in time.
>
> Sorry, but AFAICT all you have done is to advocate for the existing patch
> without having attempted to fix this problem with tty_sem. Please try to
> come up with a tty_sem-based fix.
>

The patch I proposed fixes the open vs. open race using the tty_sem. The
open vs. close race is closed by removing locking. Less locking seems
better to me.

If you're still not happy, I'll wrap the close path in the tty_sem...

thanks,

-Jason


-
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/