Skip to content

Commit 0d63d8b

Browse files
committed
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()
2 parents d4e175f + d3c5006 commit 0d63d8b

4 files changed

Lines changed: 283 additions & 182 deletions

File tree

fs/autofs/autofs_i.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include <linux/completion.h>
2626
#include <linux/file.h>
2727
#include <linux/magic.h>
28+
#include <linux/fs_context.h>
29+
#include <linux/fs_parser.h>
2830

2931
/* This is the range of ioctl() numbers we claim as ours */
3032
#define AUTOFS_IOC_FIRST AUTOFS_IOC_READY
@@ -205,20 +207,34 @@ static inline void managed_dentry_clear_managed(struct dentry *dentry)
205207

206208
/* Initializing function */
207209

208-
int autofs_fill_super(struct super_block *, void *, int);
210+
extern const struct fs_parameter_spec autofs_param_specs[];
211+
int autofs_init_fs_context(struct fs_context *fc);
209212
struct autofs_info *autofs_new_ino(struct autofs_sb_info *);
210213
void autofs_clean_ino(struct autofs_info *);
211214

212-
static inline int autofs_prepare_pipe(struct file *pipe)
215+
static inline int autofs_check_pipe(struct file *pipe)
213216
{
214217
if (!(pipe->f_mode & FMODE_CAN_WRITE))
215218
return -EINVAL;
216219
if (!S_ISFIFO(file_inode(pipe)->i_mode))
217220
return -EINVAL;
221+
return 0;
222+
}
223+
224+
static inline void autofs_set_packet_pipe_flags(struct file *pipe)
225+
{
218226
/* We want a packet pipe */
219227
pipe->f_flags |= O_DIRECT;
220228
/* We don't expect -EAGAIN */
221229
pipe->f_flags &= ~O_NONBLOCK;
230+
}
231+
232+
static inline int autofs_prepare_pipe(struct file *pipe)
233+
{
234+
int ret = autofs_check_pipe(pipe);
235+
if (ret < 0)
236+
return ret;
237+
autofs_set_packet_pipe_flags(pipe);
222238
return 0;
223239
}
224240

fs/autofs/init.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,11 @@
77
#include <linux/init.h>
88
#include "autofs_i.h"
99

10-
static struct dentry *autofs_mount(struct file_system_type *fs_type,
11-
int flags, const char *dev_name, void *data)
12-
{
13-
return mount_nodev(fs_type, flags, data, autofs_fill_super);
14-
}
15-
1610
struct file_system_type autofs_fs_type = {
1711
.owner = THIS_MODULE,
1812
.name = "autofs",
19-
.mount = autofs_mount,
13+
.init_fs_context = autofs_init_fs_context,
14+
.parameters = autofs_param_specs,
2015
.kill_sb = autofs_kill_sb,
2116
};
2217
MODULE_ALIAS_FS("autofs");

0 commit comments

Comments
 (0)