diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2009-08-08 16:52:35 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-16 12:16:42 -0500 |
commit | 2c48b9c45579a9b5e3e74694eebf3d2451f3dbd3 (patch) | |
tree | cecbf786ae0650368a8136bdd90910e05d9b95c3 /fs/file_table.c | |
parent | a95161aaa801c18c52b2e7cf3d6b4b141c00a20a (diff) |
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.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/file_table.c b/fs/file_table.c index 602a9ee3023a..163cd28314e0 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
@@ -162,8 +162,8 @@ fail: | |||
162 | * If all the callers of init_file() are eliminated, its | 162 | * If all the callers of init_file() are eliminated, its |
163 | * code should be moved into this function. | 163 | * code should be moved into this function. |
164 | */ | 164 | */ |
165 | struct file *alloc_file(struct vfsmount *mnt, struct dentry *dentry, | 165 | struct file *alloc_file(struct path *path, fmode_t mode, |
166 | fmode_t mode, const struct file_operations *fop) | 166 | const struct file_operations *fop) |
167 | { | 167 | { |
168 | struct file *file; | 168 | struct file *file; |
169 | 169 | ||
@@ -171,9 +171,8 @@ struct file *alloc_file(struct vfsmount *mnt, struct dentry *dentry, | |||
171 | if (!file) | 171 | if (!file) |
172 | return NULL; | 172 | return NULL; |
173 | 173 | ||
174 | file->f_path.dentry = dentry; | 174 | file->f_path = *path; |
175 | file->f_path.mnt = mntget(mnt); | 175 | file->f_mapping = path->dentry->d_inode->i_mapping; |
176 | file->f_mapping = dentry->d_inode->i_mapping; | ||
177 | file->f_mode = mode; | 176 | file->f_mode = mode; |
178 | file->f_op = fop; | 177 | file->f_op = fop; |
179 | 178 | ||
@@ -183,10 +182,10 @@ struct file *alloc_file(struct vfsmount *mnt, struct dentry *dentry, | |||
183 | * visible. We do this for consistency, and so | 182 | * visible. We do this for consistency, and so |
184 | * that we can do debugging checks at __fput() | 183 | * that we can do debugging checks at __fput() |
185 | */ | 184 | */ |
186 | if ((mode & FMODE_WRITE) && !special_file(dentry->d_inode->i_mode)) { | 185 | if ((mode & FMODE_WRITE) && !special_file(path->dentry->d_inode->i_mode)) { |
187 | int error = 0; | 186 | int error = 0; |
188 | file_take_write(file); | 187 | file_take_write(file); |
189 | error = mnt_clone_write(mnt); | 188 | error = mnt_clone_write(path->mnt); |
190 | WARN_ON(error); | 189 | WARN_ON(error); |
191 | } | 190 | } |
192 | return file; | 191 | return file; |