xref: /openbmc/linux/fs/autofs/inode.c (revision 36aa5eae)
1d6910058SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
2ebc921caSIan Kent /*
3ebc921caSIan Kent  * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
4ebc921caSIan Kent  * Copyright 2005-2006 Ian Kent <raven@themaw.net>
5ebc921caSIan Kent  */
6ebc921caSIan Kent 
7ebc921caSIan Kent #include <linux/seq_file.h>
8ebc921caSIan Kent #include <linux/pagemap.h>
9ebc921caSIan Kent #include <linux/parser.h>
106471e938SIan Kent 
11ebc921caSIan Kent #include "autofs_i.h"
12ebc921caSIan Kent 
autofs_new_ino(struct autofs_sb_info * sbi)13ebc921caSIan Kent struct autofs_info *autofs_new_ino(struct autofs_sb_info *sbi)
14ebc921caSIan Kent {
15ebc921caSIan Kent 	struct autofs_info *ino;
16ebc921caSIan Kent 
17ebc921caSIan Kent 	ino = kzalloc(sizeof(*ino), GFP_KERNEL);
18ebc921caSIan Kent 	if (ino) {
19ebc921caSIan Kent 		INIT_LIST_HEAD(&ino->active);
20ebc921caSIan Kent 		INIT_LIST_HEAD(&ino->expiring);
21ebc921caSIan Kent 		ino->last_used = jiffies;
22ebc921caSIan Kent 		ino->sbi = sbi;
239ccbac76SIan Kent 		ino->count = 1;
24ebc921caSIan Kent 	}
25ebc921caSIan Kent 	return ino;
26ebc921caSIan Kent }
27ebc921caSIan Kent 
autofs_clean_ino(struct autofs_info * ino)28ebc921caSIan Kent void autofs_clean_ino(struct autofs_info *ino)
29ebc921caSIan Kent {
30ebc921caSIan Kent 	ino->uid = GLOBAL_ROOT_UID;
31ebc921caSIan Kent 	ino->gid = GLOBAL_ROOT_GID;
32ebc921caSIan Kent 	ino->last_used = jiffies;
33ebc921caSIan Kent }
34ebc921caSIan Kent 
autofs_free_ino(struct autofs_info * ino)35ebc921caSIan Kent void autofs_free_ino(struct autofs_info *ino)
36ebc921caSIan Kent {
37ce285c26SAl Viro 	kfree_rcu(ino, rcu);
38ebc921caSIan Kent }
39ebc921caSIan Kent 
autofs_kill_sb(struct super_block * sb)40ebc921caSIan Kent void autofs_kill_sb(struct super_block *sb)
41ebc921caSIan Kent {
42ebc921caSIan Kent 	struct autofs_sb_info *sbi = autofs_sbi(sb);
43ebc921caSIan Kent 
44ebc921caSIan Kent 	/*
45ebc921caSIan Kent 	 * In the event of a failure in get_sb_nodev the superblock
46ebc921caSIan Kent 	 * info is not present so nothing else has been setup, so
47ebc921caSIan Kent 	 * just call kill_anon_super when we are called from
48ebc921caSIan Kent 	 * deactivate_super.
49ebc921caSIan Kent 	 */
50ebc921caSIan Kent 	if (sbi) {
51ebc921caSIan Kent 		/* Free wait queues, close pipe */
52ebc921caSIan Kent 		autofs_catatonic_mode(sbi);
53ebc921caSIan Kent 		put_pid(sbi->oz_pgrp);
54ebc921caSIan Kent 	}
55ebc921caSIan Kent 
56ebc921caSIan Kent 	pr_debug("shutting down\n");
57ebc921caSIan Kent 	kill_litter_super(sb);
58ebc921caSIan Kent 	if (sbi)
59ebc921caSIan Kent 		kfree_rcu(sbi, rcu);
60ebc921caSIan Kent }
61ebc921caSIan Kent 
autofs_show_options(struct seq_file * m,struct dentry * root)62ebc921caSIan Kent static int autofs_show_options(struct seq_file *m, struct dentry *root)
63ebc921caSIan Kent {
64ebc921caSIan Kent 	struct autofs_sb_info *sbi = autofs_sbi(root->d_sb);
65ebc921caSIan Kent 	struct inode *root_inode = d_inode(root->d_sb->s_root);
66ebc921caSIan Kent 
67ebc921caSIan Kent 	if (!sbi)
68ebc921caSIan Kent 		return 0;
69ebc921caSIan Kent 
70ebc921caSIan Kent 	seq_printf(m, ",fd=%d", sbi->pipefd);
71ebc921caSIan Kent 	if (!uid_eq(root_inode->i_uid, GLOBAL_ROOT_UID))
72ebc921caSIan Kent 		seq_printf(m, ",uid=%u",
73ebc921caSIan Kent 			from_kuid_munged(&init_user_ns, root_inode->i_uid));
74ebc921caSIan Kent 	if (!gid_eq(root_inode->i_gid, GLOBAL_ROOT_GID))
75ebc921caSIan Kent 		seq_printf(m, ",gid=%u",
76ebc921caSIan Kent 			from_kgid_munged(&init_user_ns, root_inode->i_gid));
77ebc921caSIan Kent 	seq_printf(m, ",pgrp=%d", pid_vnr(sbi->oz_pgrp));
78ebc921caSIan Kent 	seq_printf(m, ",timeout=%lu", sbi->exp_timeout/HZ);
79ebc921caSIan Kent 	seq_printf(m, ",minproto=%d", sbi->min_proto);
80ebc921caSIan Kent 	seq_printf(m, ",maxproto=%d", sbi->max_proto);
81ebc921caSIan Kent 
82ebc921caSIan Kent 	if (autofs_type_offset(sbi->type))
83874d22d6SIan Kent 		seq_puts(m, ",offset");
84ebc921caSIan Kent 	else if (autofs_type_direct(sbi->type))
85874d22d6SIan Kent 		seq_puts(m, ",direct");
86ebc921caSIan Kent 	else
87874d22d6SIan Kent 		seq_puts(m, ",indirect");
88f5162216SIan Kent 	if (sbi->flags & AUTOFS_SBI_STRICTEXPIRE)
89874d22d6SIan Kent 		seq_puts(m, ",strictexpire");
9060d6d04cSIan Kent 	if (sbi->flags & AUTOFS_SBI_IGNORE)
91874d22d6SIan Kent 		seq_puts(m, ",ignore");
92ebc921caSIan Kent #ifdef CONFIG_CHECKPOINT_RESTORE
93ebc921caSIan Kent 	if (sbi->pipe)
94ebc921caSIan Kent 		seq_printf(m, ",pipe_ino=%ld", file_inode(sbi->pipe)->i_ino);
95ebc921caSIan Kent 	else
96874d22d6SIan Kent 		seq_puts(m, ",pipe_ino=-1");
97ebc921caSIan Kent #endif
98ebc921caSIan Kent 	return 0;
99ebc921caSIan Kent }
100ebc921caSIan Kent 
autofs_evict_inode(struct inode * inode)101ebc921caSIan Kent static void autofs_evict_inode(struct inode *inode)
102ebc921caSIan Kent {
103ebc921caSIan Kent 	clear_inode(inode);
104ebc921caSIan Kent 	kfree(inode->i_private);
105ebc921caSIan Kent }
106ebc921caSIan Kent 
107ebc921caSIan Kent static const struct super_operations autofs_sops = {
108ebc921caSIan Kent 	.statfs		= simple_statfs,
109ebc921caSIan Kent 	.show_options	= autofs_show_options,
110ebc921caSIan Kent 	.evict_inode	= autofs_evict_inode,
111ebc921caSIan Kent };
112ebc921caSIan Kent 
113ebc921caSIan Kent enum {Opt_err, Opt_fd, Opt_uid, Opt_gid, Opt_pgrp, Opt_minproto, Opt_maxproto,
11460d6d04cSIan Kent 	Opt_indirect, Opt_direct, Opt_offset, Opt_strictexpire,
11560d6d04cSIan Kent 	Opt_ignore};
116ebc921caSIan Kent 
117ebc921caSIan Kent static const match_table_t tokens = {
118ebc921caSIan Kent 	{Opt_fd, "fd=%u"},
119ebc921caSIan Kent 	{Opt_uid, "uid=%u"},
120ebc921caSIan Kent 	{Opt_gid, "gid=%u"},
121ebc921caSIan Kent 	{Opt_pgrp, "pgrp=%u"},
122ebc921caSIan Kent 	{Opt_minproto, "minproto=%u"},
123ebc921caSIan Kent 	{Opt_maxproto, "maxproto=%u"},
124ebc921caSIan Kent 	{Opt_indirect, "indirect"},
125ebc921caSIan Kent 	{Opt_direct, "direct"},
126ebc921caSIan Kent 	{Opt_offset, "offset"},
127f5162216SIan Kent 	{Opt_strictexpire, "strictexpire"},
12860d6d04cSIan Kent 	{Opt_ignore, "ignore"},
129ebc921caSIan Kent 	{Opt_err, NULL}
130ebc921caSIan Kent };
131ebc921caSIan Kent 
parse_options(char * options,struct inode * root,int * pgrp,bool * pgrp_set,struct autofs_sb_info * sbi)1329bf964c9SIan Kent static int parse_options(char *options,
1339bf964c9SIan Kent 			 struct inode *root, int *pgrp, bool *pgrp_set,
1349bf964c9SIan Kent 			 struct autofs_sb_info *sbi)
135ebc921caSIan Kent {
136ebc921caSIan Kent 	char *p;
137ebc921caSIan Kent 	substring_t args[MAX_OPT_ARGS];
138ebc921caSIan Kent 	int option;
1399bf964c9SIan Kent 	int pipefd = -1;
1409bf964c9SIan Kent 	kuid_t uid;
1419bf964c9SIan Kent 	kgid_t gid;
142ebc921caSIan Kent 
1439bf964c9SIan Kent 	root->i_uid = current_uid();
1449bf964c9SIan Kent 	root->i_gid = current_gid();
145ebc921caSIan Kent 
1469bf964c9SIan Kent 	sbi->min_proto = AUTOFS_MIN_PROTO_VERSION;
1479bf964c9SIan Kent 	sbi->max_proto = AUTOFS_MAX_PROTO_VERSION;
148ebc921caSIan Kent 
1499bf964c9SIan Kent 	sbi->pipefd = -1;
150ebc921caSIan Kent 
151ebc921caSIan Kent 	if (!options)
152ebc921caSIan Kent 		return 1;
153ebc921caSIan Kent 
154ebc921caSIan Kent 	while ((p = strsep(&options, ",")) != NULL) {
155ebc921caSIan Kent 		int token;
156ebc921caSIan Kent 
157ebc921caSIan Kent 		if (!*p)
158ebc921caSIan Kent 			continue;
159ebc921caSIan Kent 
160ebc921caSIan Kent 		token = match_token(p, tokens, args);
161ebc921caSIan Kent 		switch (token) {
162ebc921caSIan Kent 		case Opt_fd:
1639bf964c9SIan Kent 			if (match_int(args, &pipefd))
164ebc921caSIan Kent 				return 1;
1659bf964c9SIan Kent 			sbi->pipefd = pipefd;
166ebc921caSIan Kent 			break;
167ebc921caSIan Kent 		case Opt_uid:
168ebc921caSIan Kent 			if (match_int(args, &option))
169ebc921caSIan Kent 				return 1;
1709bf964c9SIan Kent 			uid = make_kuid(current_user_ns(), option);
1719bf964c9SIan Kent 			if (!uid_valid(uid))
172ebc921caSIan Kent 				return 1;
1739bf964c9SIan Kent 			root->i_uid = uid;
174ebc921caSIan Kent 			break;
175ebc921caSIan Kent 		case Opt_gid:
176ebc921caSIan Kent 			if (match_int(args, &option))
177ebc921caSIan Kent 				return 1;
1789bf964c9SIan Kent 			gid = make_kgid(current_user_ns(), option);
1799bf964c9SIan Kent 			if (!gid_valid(gid))
180ebc921caSIan Kent 				return 1;
1819bf964c9SIan Kent 			root->i_gid = gid;
182ebc921caSIan Kent 			break;
183ebc921caSIan Kent 		case Opt_pgrp:
184ebc921caSIan Kent 			if (match_int(args, &option))
185ebc921caSIan Kent 				return 1;
186ebc921caSIan Kent 			*pgrp = option;
187ebc921caSIan Kent 			*pgrp_set = true;
188ebc921caSIan Kent 			break;
189ebc921caSIan Kent 		case Opt_minproto:
190ebc921caSIan Kent 			if (match_int(args, &option))
191ebc921caSIan Kent 				return 1;
1929bf964c9SIan Kent 			sbi->min_proto = option;
193ebc921caSIan Kent 			break;
194ebc921caSIan Kent 		case Opt_maxproto:
195ebc921caSIan Kent 			if (match_int(args, &option))
196ebc921caSIan Kent 				return 1;
1979bf964c9SIan Kent 			sbi->max_proto = option;
198ebc921caSIan Kent 			break;
199ebc921caSIan Kent 		case Opt_indirect:
2009bf964c9SIan Kent 			set_autofs_type_indirect(&sbi->type);
201ebc921caSIan Kent 			break;
202ebc921caSIan Kent 		case Opt_direct:
2039bf964c9SIan Kent 			set_autofs_type_direct(&sbi->type);
204ebc921caSIan Kent 			break;
205ebc921caSIan Kent 		case Opt_offset:
2069bf964c9SIan Kent 			set_autofs_type_offset(&sbi->type);
207ebc921caSIan Kent 			break;
208f5162216SIan Kent 		case Opt_strictexpire:
209f5162216SIan Kent 			sbi->flags |= AUTOFS_SBI_STRICTEXPIRE;
210f5162216SIan Kent 			break;
21160d6d04cSIan Kent 		case Opt_ignore:
21260d6d04cSIan Kent 			sbi->flags |= AUTOFS_SBI_IGNORE;
21360d6d04cSIan Kent 			break;
214ebc921caSIan Kent 		default:
215ebc921caSIan Kent 			return 1;
216ebc921caSIan Kent 		}
217ebc921caSIan Kent 	}
2189bf964c9SIan Kent 	return (sbi->pipefd < 0);
219ebc921caSIan Kent }
220ebc921caSIan Kent 
autofs_fill_super(struct super_block * s,void * data,int silent)221ebc921caSIan Kent int autofs_fill_super(struct super_block *s, void *data, int silent)
222ebc921caSIan Kent {
223ebc921caSIan Kent 	struct inode *root_inode;
224ebc921caSIan Kent 	struct dentry *root;
225ebc921caSIan Kent 	struct file *pipe;
226ebc921caSIan Kent 	struct autofs_sb_info *sbi;
227ebc921caSIan Kent 	struct autofs_info *ino;
228ebc921caSIan Kent 	int pgrp = 0;
229ebc921caSIan Kent 	bool pgrp_set = false;
230ebc921caSIan Kent 	int ret = -EINVAL;
231ebc921caSIan Kent 
232ebc921caSIan Kent 	sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
233ebc921caSIan Kent 	if (!sbi)
234ebc921caSIan Kent 		return -ENOMEM;
235ebc921caSIan Kent 	pr_debug("starting up, sbi = %p\n", sbi);
236ebc921caSIan Kent 
237ebc921caSIan Kent 	s->s_fs_info = sbi;
238ebc921caSIan Kent 	sbi->magic = AUTOFS_SBI_MAGIC;
239ebc921caSIan Kent 	sbi->pipefd = -1;
240ebc921caSIan Kent 	sbi->pipe = NULL;
241ebc921caSIan Kent 	sbi->exp_timeout = 0;
242ebc921caSIan Kent 	sbi->oz_pgrp = NULL;
243ebc921caSIan Kent 	sbi->sb = s;
244ebc921caSIan Kent 	sbi->version = 0;
245ebc921caSIan Kent 	sbi->sub_version = 0;
2469d8719a4SIan Kent 	sbi->flags = AUTOFS_SBI_CATATONIC;
247ebc921caSIan Kent 	set_autofs_type_indirect(&sbi->type);
248ebc921caSIan Kent 	sbi->min_proto = 0;
249ebc921caSIan Kent 	sbi->max_proto = 0;
250ebc921caSIan Kent 	mutex_init(&sbi->wq_mutex);
251ebc921caSIan Kent 	mutex_init(&sbi->pipe_mutex);
252ebc921caSIan Kent 	spin_lock_init(&sbi->fs_lock);
253ebc921caSIan Kent 	sbi->queues = NULL;
254ebc921caSIan Kent 	spin_lock_init(&sbi->lookup_lock);
255ebc921caSIan Kent 	INIT_LIST_HEAD(&sbi->active_list);
256ebc921caSIan Kent 	INIT_LIST_HEAD(&sbi->expiring_list);
257ebc921caSIan Kent 	s->s_blocksize = 1024;
258ebc921caSIan Kent 	s->s_blocksize_bits = 10;
259ebc921caSIan Kent 	s->s_magic = AUTOFS_SUPER_MAGIC;
260ebc921caSIan Kent 	s->s_op = &autofs_sops;
261ebc921caSIan Kent 	s->s_d_op = &autofs_dentry_operations;
262ebc921caSIan Kent 	s->s_time_gran = 1;
263ebc921caSIan Kent 
264ebc921caSIan Kent 	/*
265ebc921caSIan Kent 	 * Get the root inode and dentry, but defer checking for errors.
266ebc921caSIan Kent 	 */
267ebc921caSIan Kent 	ino = autofs_new_ino(sbi);
268ebc921caSIan Kent 	if (!ino) {
269ebc921caSIan Kent 		ret = -ENOMEM;
270ebc921caSIan Kent 		goto fail_free;
271ebc921caSIan Kent 	}
272ebc921caSIan Kent 	root_inode = autofs_get_inode(s, S_IFDIR | 0755);
273ebc921caSIan Kent 	root = d_make_root(root_inode);
274f585b283SIan Kent 	if (!root) {
275f585b283SIan Kent 		ret = -ENOMEM;
276ebc921caSIan Kent 		goto fail_ino;
277f585b283SIan Kent 	}
278ebc921caSIan Kent 	pipe = NULL;
279ebc921caSIan Kent 
280ebc921caSIan Kent 	root->d_fsdata = ino;
281ebc921caSIan Kent 
282ebc921caSIan Kent 	/* Can this call block? */
2839bf964c9SIan Kent 	if (parse_options(data, root_inode, &pgrp, &pgrp_set, sbi)) {
284ebc921caSIan Kent 		pr_err("called with bogus options\n");
285ebc921caSIan Kent 		goto fail_dput;
286ebc921caSIan Kent 	}
287ebc921caSIan Kent 
288ebc921caSIan Kent 	/* Test versions first */
289ebc921caSIan Kent 	if (sbi->max_proto < AUTOFS_MIN_PROTO_VERSION ||
290ebc921caSIan Kent 	    sbi->min_proto > AUTOFS_MAX_PROTO_VERSION) {
291ebc921caSIan Kent 		pr_err("kernel does not match daemon version "
292ebc921caSIan Kent 		       "daemon (%d, %d) kernel (%d, %d)\n",
293ebc921caSIan Kent 		       sbi->min_proto, sbi->max_proto,
294ebc921caSIan Kent 		       AUTOFS_MIN_PROTO_VERSION, AUTOFS_MAX_PROTO_VERSION);
295ebc921caSIan Kent 		goto fail_dput;
296ebc921caSIan Kent 	}
297ebc921caSIan Kent 
298ebc921caSIan Kent 	/* Establish highest kernel protocol version */
299ebc921caSIan Kent 	if (sbi->max_proto > AUTOFS_MAX_PROTO_VERSION)
300ebc921caSIan Kent 		sbi->version = AUTOFS_MAX_PROTO_VERSION;
301ebc921caSIan Kent 	else
302ebc921caSIan Kent 		sbi->version = sbi->max_proto;
303ebc921caSIan Kent 	sbi->sub_version = AUTOFS_PROTO_SUBVERSION;
304ebc921caSIan Kent 
305ebc921caSIan Kent 	if (pgrp_set) {
306ebc921caSIan Kent 		sbi->oz_pgrp = find_get_pid(pgrp);
307ebc921caSIan Kent 		if (!sbi->oz_pgrp) {
308ebc921caSIan Kent 			pr_err("could not find process group %d\n",
309ebc921caSIan Kent 				pgrp);
310ebc921caSIan Kent 			goto fail_dput;
311ebc921caSIan Kent 		}
312ebc921caSIan Kent 	} else {
313ebc921caSIan Kent 		sbi->oz_pgrp = get_task_pid(current, PIDTYPE_PGID);
314ebc921caSIan Kent 	}
315ebc921caSIan Kent 
316ebc921caSIan Kent 	if (autofs_type_trigger(sbi->type))
317ebc921caSIan Kent 		__managed_dentry_set_managed(root);
318ebc921caSIan Kent 
319ebc921caSIan Kent 	root_inode->i_fop = &autofs_root_operations;
320ebc921caSIan Kent 	root_inode->i_op = &autofs_dir_inode_operations;
321ebc921caSIan Kent 
3229bf964c9SIan Kent 	pr_debug("pipe fd = %d, pgrp = %u\n",
3239bf964c9SIan Kent 		 sbi->pipefd, pid_nr(sbi->oz_pgrp));
3249bf964c9SIan Kent 	pipe = fget(sbi->pipefd);
325ebc921caSIan Kent 
326ebc921caSIan Kent 	if (!pipe) {
327ebc921caSIan Kent 		pr_err("could not open pipe file descriptor\n");
328ebc921caSIan Kent 		goto fail_put_pid;
329ebc921caSIan Kent 	}
330ebc921caSIan Kent 	ret = autofs_prepare_pipe(pipe);
331ebc921caSIan Kent 	if (ret < 0)
332ebc921caSIan Kent 		goto fail_fput;
333ebc921caSIan Kent 	sbi->pipe = pipe;
3349d8719a4SIan Kent 	sbi->flags &= ~AUTOFS_SBI_CATATONIC;
335ebc921caSIan Kent 
336ebc921caSIan Kent 	/*
337ebc921caSIan Kent 	 * Success! Install the root dentry now to indicate completion.
338ebc921caSIan Kent 	 */
339ebc921caSIan Kent 	s->s_root = root;
340ebc921caSIan Kent 	return 0;
341ebc921caSIan Kent 
342ebc921caSIan Kent 	/*
343ebc921caSIan Kent 	 * Failure ... clean up.
344ebc921caSIan Kent 	 */
345ebc921caSIan Kent fail_fput:
346ebc921caSIan Kent 	pr_err("pipe file descriptor does not contain proper ops\n");
347ebc921caSIan Kent 	fput(pipe);
348ebc921caSIan Kent fail_put_pid:
349ebc921caSIan Kent 	put_pid(sbi->oz_pgrp);
350ebc921caSIan Kent fail_dput:
351ebc921caSIan Kent 	dput(root);
352ebc921caSIan Kent 	goto fail_free;
353ebc921caSIan Kent fail_ino:
354ebc921caSIan Kent 	autofs_free_ino(ino);
355ebc921caSIan Kent fail_free:
356ebc921caSIan Kent 	kfree(sbi);
357ebc921caSIan Kent 	s->s_fs_info = NULL;
358ebc921caSIan Kent 	return ret;
359ebc921caSIan Kent }
360ebc921caSIan Kent 
autofs_get_inode(struct super_block * sb,umode_t mode)361ebc921caSIan Kent struct inode *autofs_get_inode(struct super_block *sb, umode_t mode)
362ebc921caSIan Kent {
363ebc921caSIan Kent 	struct inode *inode = new_inode(sb);
364ebc921caSIan Kent 
365ebc921caSIan Kent 	if (inode == NULL)
366ebc921caSIan Kent 		return NULL;
367ebc921caSIan Kent 
368ebc921caSIan Kent 	inode->i_mode = mode;
369ebc921caSIan Kent 	if (sb->s_root) {
370ebc921caSIan Kent 		inode->i_uid = d_inode(sb->s_root)->i_uid;
371ebc921caSIan Kent 		inode->i_gid = d_inode(sb->s_root)->i_gid;
372ebc921caSIan Kent 	}
373*36aa5eaeSJeff Layton 	inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
374ebc921caSIan Kent 	inode->i_ino = get_next_ino();
375ebc921caSIan Kent 
376ebc921caSIan Kent 	if (S_ISDIR(mode)) {
377ebc921caSIan Kent 		set_nlink(inode, 2);
378ebc921caSIan Kent 		inode->i_op = &autofs_dir_inode_operations;
379ebc921caSIan Kent 		inode->i_fop = &autofs_dir_operations;
380ebc921caSIan Kent 	} else if (S_ISLNK(mode)) {
381ebc921caSIan Kent 		inode->i_op = &autofs_symlink_inode_operations;
382ebc921caSIan Kent 	} else
383ebc921caSIan Kent 		WARN_ON(1);
384ebc921caSIan Kent 
385ebc921caSIan Kent 	return inode;
386ebc921caSIan Kent }
387