diff options
author | Oleg Drokin <green@linuxhacker.ru> | 2006-03-25 06:07:02 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 11:22:51 -0500 |
commit | 9a56c213929d83139fd1e12727e1037d71b519f8 (patch) | |
tree | 013dd77c7cae23bd8fb821175a0d6fdc35bad9fe | |
parent | b500531e6f5f234ed267bd7060ee06d144faf0ca (diff) |
[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>
-rw-r--r-- | fs/open.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -890,6 +890,10 @@ EXPORT_SYMBOL(filp_open); | |||
890 | * a fully instantiated struct file to the caller. | 890 | * a fully instantiated struct file to the caller. |
891 | * This function is meant to be called from within a filesystem's | 891 | * This function is meant to be called from within a filesystem's |
892 | * lookup method. | 892 | * lookup method. |
893 | * Beware of calling it for non-regular files! Those ->open methods might block | ||
894 | * (e.g. in fifo_open), leaving you with parent locked (and in case of fifo, | ||
895 | * leading to a deadlock, as nobody can open that fifo anymore, because | ||
896 | * another process to open fifo will block on locked parent when doing lookup). | ||
893 | * Note that in case of error, nd->intent.open.file is destroyed, but the | 897 | * Note that in case of error, nd->intent.open.file is destroyed, but the |
894 | * path information remains valid. | 898 | * path information remains valid. |
895 | * If the open callback is set to NULL, then the standard f_op->open() | 899 | * If the open callback is set to NULL, then the standard f_op->open() |