Re: [PATCH, RFC] char dev BKL pushdown

From: Arnd Bergmann
Date: Sat May 17 2008 - 17:15:44 EST


On Friday 16 May 2008, Jonathan Corbet wrote:

> ...and so that's what I've done. My approach was to find every
> register_chrdev() and cdev_add() call, look at the associated
> file_operations, then go back to the open() function, if any.

Note that the majority of drivers use (grep suggests up to 165
of them) uses misc_register instead of register_chrdev/cdev_add.
Your patches are still correct, because you pushed the BKL into the
misc_open function, but there is an obvious next step in pushing
it further into the misc drivers.
There are probably a few more subsystems with minor number specific
open() functions, misc is just the obvious one.

> > ...and so that's what I've done.  My approach was to find every
> register_chrdev() and cdev_add() call, look at the associated
> file_operations, then go back to the open() function, if any.  Unless it
> was almost immediately obvious to me that the function was either (1) so
> trivial as to not require locking (quite few of them are "return 0;"), or
> (2) clearly doing its own locking, I wrapped the code in the BKL.
>
> Finally, I removed the BKL from chrdev_open().

In your current git tree, this change is no longer the final one, so
bisecting the series may cause other bugs. You should probably reorder
the patches at some point to avoid this.

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