diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-08-12 18:04:37 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-09-26 21:08:51 -0400 |
commit | c921b40d6201f7ec7b1edf7ea9a844f93e1a27f4 (patch) | |
tree | 11d4837e161766d30056dfd0ba5ef6f37ec68277 | |
parent | 1a7bd2265fc57f29400d57f66275cc5918e30aa6 (diff) |
autofs4: don't open-code fd_install()
The only difference between autofs_dev_ioctl_fd_install() and
fd_install() is __set_close_on_exec() done by the latter. Just
use get_unused_fd_flags(O_CLOEXEC) to allocate the descriptor
and be done with that...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/autofs4/dev-ioctl.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c index abf645c1703b..a16214109d31 100644 --- a/fs/autofs4/dev-ioctl.c +++ b/fs/autofs4/dev-ioctl.c | |||
@@ -221,20 +221,6 @@ static int test_by_type(struct path *path, void *p) | |||
221 | return ino && ino->sbi->type & *(unsigned *)p; | 221 | return ino && ino->sbi->type & *(unsigned *)p; |
222 | } | 222 | } |
223 | 223 | ||
224 | static void autofs_dev_ioctl_fd_install(unsigned int fd, struct file *file) | ||
225 | { | ||
226 | struct files_struct *files = current->files; | ||
227 | struct fdtable *fdt; | ||
228 | |||
229 | spin_lock(&files->file_lock); | ||
230 | fdt = files_fdtable(files); | ||
231 | BUG_ON(fdt->fd[fd] != NULL); | ||
232 | rcu_assign_pointer(fdt->fd[fd], file); | ||
233 | __set_close_on_exec(fd, fdt); | ||
234 | spin_unlock(&files->file_lock); | ||
235 | } | ||
236 | |||
237 | |||
238 | /* | 224 | /* |
239 | * Open a file descriptor on the autofs mount point corresponding | 225 | * Open a file descriptor on the autofs mount point corresponding |
240 | * to the given path and device number (aka. new_encode_dev(sb->s_dev)). | 226 | * to the given path and device number (aka. new_encode_dev(sb->s_dev)). |
@@ -243,7 +229,7 @@ static int autofs_dev_ioctl_open_mountpoint(const char *name, dev_t devid) | |||
243 | { | 229 | { |
244 | int err, fd; | 230 | int err, fd; |
245 | 231 | ||
246 | fd = get_unused_fd(); | 232 | fd = get_unused_fd_flags(O_CLOEXEC); |
247 | if (likely(fd >= 0)) { | 233 | if (likely(fd >= 0)) { |
248 | struct file *filp; | 234 | struct file *filp; |
249 | struct path path; | 235 | struct path path; |
@@ -264,7 +250,7 @@ static int autofs_dev_ioctl_open_mountpoint(const char *name, dev_t devid) | |||
264 | goto out; | 250 | goto out; |
265 | } | 251 | } |
266 | 252 | ||
267 | autofs_dev_ioctl_fd_install(fd, filp); | 253 | fd_install(fd, filp); |
268 | } | 254 | } |
269 | 255 | ||
270 | return fd; | 256 | return fd; |