aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/anon_inodes.h
diff options
context:
space:
mode:
authorDavide Libenzi <davidel@xmailserver.org>2009-09-22 19:43:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:29 -0400
commit562787a5c32ccdf182de27793a83a9f2ee86cd77 (patch)
tree3308afd59d3b7449afa3d6a6cd624d06ce035e88 /include/linux/anon_inodes.h
parent515350b6fd041396f425180589e08812dd13615f (diff)
anonfd: split interface into file creation and install
Split the anonfd interface into a bare file pointer creation one, and a file pointer creation plus install one. There are cases, like the usage of eventfds inside other kernel interfaces, where the file pointer created by anonfd needs to be used inside the initialization of other structures. As it is right now, as soon as anon_inode_getfd() returns, the kenrle can race with userspace closing the newly installed file descriptor. This patch, while keeping the old anon_inode_getfd(), introduces a new anon_inode_getfile() (whose services are reused in anon_inode_getfd()) that allows to split the file creation phase and the fd install one. Once all the kernel structures are initialized, the code can call the proper fd_install(). Gregory manifested the need for something like this inside KVM. Signed-off-by: Davide Libenzi <davidel@xmailserver.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: James Morris <jmorris@namei.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Gregory Haskins <ghaskins@novell.com> Acked-by: Serge Hallyn <serue@us.ibm.com> Acked-by: Roland Dreier <rolandd@cisco.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/anon_inodes.h')
-rw-r--r--include/linux/anon_inodes.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/anon_inodes.h b/include/linux/anon_inodes.h
index e0a0cdc2da43..69a21e0ebd33 100644
--- a/include/linux/anon_inodes.h
+++ b/include/linux/anon_inodes.h
@@ -8,6 +8,9 @@
8#ifndef _LINUX_ANON_INODES_H 8#ifndef _LINUX_ANON_INODES_H
9#define _LINUX_ANON_INODES_H 9#define _LINUX_ANON_INODES_H
10 10
11struct file *anon_inode_getfile(const char *name,
12 const struct file_operations *fops,
13 void *priv, int flags);
11int anon_inode_getfd(const char *name, const struct file_operations *fops, 14int anon_inode_getfd(const char *name, const struct file_operations *fops,
12 void *priv, int flags); 15 void *priv, int flags);
13 16