Commit 0d63d8b2 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'vfs-6.7.autofs' of gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs

Pull autofs mount api updates from Christian Brauner:
 "This ports autofs to the new mount api. The patchset has existed for
  quite a while but never made it upstream. Ian picked it back up.

  This also fixes a bug where fs_param_is_fd() was passed a garbage
  param->dirfd but it expected it to be set to the fd that was used to
  set param->file otherwise result->uint_32 contains nonsense. So make
  sure it's set.

  One less filesystem using the old mount api. We're getting there,
  albeit rather slow. The last remaining major filesystem that hasn't
  converted is btrfs. Patches exist - I even wrote them - but so far
  they haven't made it upstream"

* tag 'vfs-6.7.autofs' of gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs:
  autofs: fix add autofs_parse_fd()
  fsconfig: ensure that dirfd is set to aux
  autofs: fix protocol sub version setting
  autofs: convert autofs to use the new mount api
  autofs: validate protocol version
  autofs: refactor parse_options()
  autofs: reformat 0pt enum declaration
  autofs: refactor super block info init
  autofs: add autofs_parse_fd()
  autofs: refactor autofs_prepare_pipe()
parents d4e175f2 d3c50061
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/file.h> #include <linux/file.h>
#include <linux/magic.h> #include <linux/magic.h>
#include <linux/fs_context.h>
#include <linux/fs_parser.h>
/* This is the range of ioctl() numbers we claim as ours */ /* This is the range of ioctl() numbers we claim as ours */
#define AUTOFS_IOC_FIRST AUTOFS_IOC_READY #define AUTOFS_IOC_FIRST AUTOFS_IOC_READY
...@@ -205,20 +207,34 @@ static inline void managed_dentry_clear_managed(struct dentry *dentry) ...@@ -205,20 +207,34 @@ static inline void managed_dentry_clear_managed(struct dentry *dentry)
/* Initializing function */ /* Initializing function */
int autofs_fill_super(struct super_block *, void *, int); extern const struct fs_parameter_spec autofs_param_specs[];
int autofs_init_fs_context(struct fs_context *fc);
struct autofs_info *autofs_new_ino(struct autofs_sb_info *); struct autofs_info *autofs_new_ino(struct autofs_sb_info *);
void autofs_clean_ino(struct autofs_info *); void autofs_clean_ino(struct autofs_info *);
static inline int autofs_prepare_pipe(struct file *pipe) static inline int autofs_check_pipe(struct file *pipe)
{ {
if (!(pipe->f_mode & FMODE_CAN_WRITE)) if (!(pipe->f_mode & FMODE_CAN_WRITE))
return -EINVAL; return -EINVAL;
if (!S_ISFIFO(file_inode(pipe)->i_mode)) if (!S_ISFIFO(file_inode(pipe)->i_mode))
return -EINVAL; return -EINVAL;
return 0;
}
static inline void autofs_set_packet_pipe_flags(struct file *pipe)
{
/* We want a packet pipe */ /* We want a packet pipe */
pipe->f_flags |= O_DIRECT; pipe->f_flags |= O_DIRECT;
/* We don't expect -EAGAIN */ /* We don't expect -EAGAIN */
pipe->f_flags &= ~O_NONBLOCK; pipe->f_flags &= ~O_NONBLOCK;
}
static inline int autofs_prepare_pipe(struct file *pipe)
{
int ret = autofs_check_pipe(pipe);
if (ret < 0)
return ret;
autofs_set_packet_pipe_flags(pipe);
return 0; return 0;
} }
......
...@@ -7,16 +7,11 @@ ...@@ -7,16 +7,11 @@
#include <linux/init.h> #include <linux/init.h>
#include "autofs_i.h" #include "autofs_i.h"
static struct dentry *autofs_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data)
{
return mount_nodev(fs_type, flags, data, autofs_fill_super);
}
struct file_system_type autofs_fs_type = { struct file_system_type autofs_fs_type = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "autofs", .name = "autofs",
.mount = autofs_mount, .init_fs_context = autofs_init_fs_context,
.parameters = autofs_param_specs,
.kill_sb = autofs_kill_sb, .kill_sb = autofs_kill_sb,
}; };
MODULE_ALIAS_FS("autofs"); MODULE_ALIAS_FS("autofs");
......
This diff is collapsed.
...@@ -465,6 +465,7 @@ SYSCALL_DEFINE5(fsconfig, ...@@ -465,6 +465,7 @@ SYSCALL_DEFINE5(fsconfig,
param.file = fget(aux); param.file = fget(aux);
if (!param.file) if (!param.file)
goto out_key; goto out_key;
param.dirfd = aux;
break; break;
default: default:
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment