return ino && ino->sbi->type & *(unsigned *)p;
 }
 
-static void autofs_dev_ioctl_fd_install(unsigned int fd, struct file *file)
-{
-       struct files_struct *files = current->files;
-       struct fdtable *fdt;
-
-       spin_lock(&files->file_lock);
-       fdt = files_fdtable(files);
-       BUG_ON(fdt->fd[fd] != NULL);
-       rcu_assign_pointer(fdt->fd[fd], file);
-       __set_close_on_exec(fd, fdt);
-       spin_unlock(&files->file_lock);
-}
-
-
 /*
  * Open a file descriptor on the autofs mount point corresponding
  * to the given path and device number (aka. new_encode_dev(sb->s_dev)).
 {
        int err, fd;
 
-       fd = get_unused_fd();
+       fd = get_unused_fd_flags(O_CLOEXEC);
        if (likely(fd >= 0)) {
                struct file *filp;
                struct path path;
                        goto out;
                }
 
-               autofs_dev_ioctl_fd_install(fd, filp);
+               fd_install(fd, filp);
        }
 
        return fd;