mirror of
https://github.com/torvalds/linux.git
synced 2024-12-29 06:12:08 +00:00
[PATCH] Add lookup_instantiate_filp usage warning
I think it would be nice to put an usage warning in header of lookup_instantiate_filp() to indicate it is unsafe to use it on anything but regular files (even that is potentially unsafe, but there your ->open() is usually in your hands anyway), so that others won't fall into the same trap I did. Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
b500531e6f
commit
9a56c21392
@ -890,6 +890,10 @@ EXPORT_SYMBOL(filp_open);
|
|||||||
* a fully instantiated struct file to the caller.
|
* a fully instantiated struct file to the caller.
|
||||||
* This function is meant to be called from within a filesystem's
|
* This function is meant to be called from within a filesystem's
|
||||||
* lookup method.
|
* lookup method.
|
||||||
|
* Beware of calling it for non-regular files! Those ->open methods might block
|
||||||
|
* (e.g. in fifo_open), leaving you with parent locked (and in case of fifo,
|
||||||
|
* leading to a deadlock, as nobody can open that fifo anymore, because
|
||||||
|
* another process to open fifo will block on locked parent when doing lookup).
|
||||||
* Note that in case of error, nd->intent.open.file is destroyed, but the
|
* Note that in case of error, nd->intent.open.file is destroyed, but the
|
||||||
* path information remains valid.
|
* path information remains valid.
|
||||||
* If the open callback is set to NULL, then the standard f_op->open()
|
* If the open callback is set to NULL, then the standard f_op->open()
|
||||||
|
Loading…
Reference in New Issue
Block a user