summaryrefslogtreecommitdiff
path: root/fs/file_table.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-08-09 00:52:35 +0400
committerAl Viro <viro@zeniv.linux.org.uk>2009-12-16 12:16:42 -0500
commit2c48b9c45579a9b5e3e74694eebf3d2451f3dbd3 (patch)
treececbf786ae0650368a8136bdd90910e05d9b95c3 /fs/file_table.c
parenta95161aaa801c18c52b2e7cf3d6b4b141c00a20a (diff)
downloadlinux-3.10-2c48b9c45579a9b5e3e74694eebf3d2451f3dbd3.tar.gz
linux-3.10-2c48b9c45579a9b5e3e74694eebf3d2451f3dbd3.tar.bz2
linux-3.10-2c48b9c45579a9b5e3e74694eebf3d2451f3dbd3.zip
switch alloc_file() to passing struct path
... and have the caller grab both mnt and dentry; kill leak in infiniband, while we are at it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/file_table.c')
-rw-r--r--fs/file_table.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/file_table.c b/fs/file_table.c
index 602a9ee3023..163cd28314e 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -162,8 +162,8 @@ fail:
* If all the callers of init_file() are eliminated, its
* code should be moved into this function.
*/
-struct file *alloc_file(struct vfsmount *mnt, struct dentry *dentry,
- fmode_t mode, const struct file_operations *fop)
+struct file *alloc_file(struct path *path, fmode_t mode,
+ const struct file_operations *fop)
{
struct file *file;
@@ -171,9 +171,8 @@ struct file *alloc_file(struct vfsmount *mnt, struct dentry *dentry,
if (!file)
return NULL;
- file->f_path.dentry = dentry;
- file->f_path.mnt = mntget(mnt);
- file->f_mapping = dentry->d_inode->i_mapping;
+ file->f_path = *path;
+ file->f_mapping = path->dentry->d_inode->i_mapping;
file->f_mode = mode;
file->f_op = fop;
@@ -183,10 +182,10 @@ struct file *alloc_file(struct vfsmount *mnt, struct dentry *dentry,
* visible. We do this for consistency, and so
* that we can do debugging checks at __fput()
*/
- if ((mode & FMODE_WRITE) && !special_file(dentry->d_inode->i_mode)) {
+ if ((mode & FMODE_WRITE) && !special_file(path->dentry->d_inode->i_mode)) {
int error = 0;
file_take_write(file);
- error = mnt_clone_write(mnt);
+ error = mnt_clone_write(path->mnt);
WARN_ON(error);
}
return file;