Re: [PATCH 3/5] tty: handle VT specific compat ioctls in vt driver

Frederic Weisbecker
2009-08-07T19:23:38Z

On Fri, Aug 07, 2009 at 10:57:32AM +0100, Alan Cox wrote:
> On Fri, 7 Aug 2009 08:23:58 +0200
> Frederic Weisbecker <fweisbec@gmail.com> wrote:
>
> > Hi,
> >
> >
> > On Thu, Aug 06, 2009 at 03:09:28PM +0200, Arnd Bergmann wrote:
> > > The VT specific compat_ioctl handlers are the only ones
> > > in common code that require the BKL. Moving them into
> > > the vt driver lets us remove the BKL from the other handlers
> > > and cleans up the code.
> >
> >
> > Why does it require the bkl?
>
> It's always taken the BKL - you have to prove it doesn't need it. Which
> btw isn't true - it does need it in various places still.
>
> Alan

It was a way to tell "I would like to know what it is protecting" ;-)
I can imagine it is not here for no reason, the problem is to find why.

As an example, to find the reason of the following lines in do_tty_hangup():

/* inuse_filps is protected by the single kernel lock */
lock_kernel();

I had to look at a 2.2 kernel. At this time, inuse_filps existed,
and now it is replaced by the tty->tty_files field, which
is protected by file_list_lock().

So according to the comment, we can remove the bkl there, but what
guarantees its role hasn't evolved since then to make it protecting
something else...