diff options
Diffstat (limited to 'fs/autofs4')
-rw-r--r-- | fs/autofs4/autofs_i.h | 3 | ||||
-rw-r--r-- | fs/autofs4/inode.c | 37 |
2 files changed, 34 insertions, 6 deletions
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h index 00da71d0f32a..d82a019ff8ef 100644 --- a/fs/autofs4/autofs_i.h +++ b/fs/autofs4/autofs_i.h | |||
@@ -87,11 +87,14 @@ struct autofs_wait_queue { | |||
87 | struct autofs_sb_info { | 87 | struct autofs_sb_info { |
88 | u32 magic; | 88 | u32 magic; |
89 | struct dentry *root; | 89 | struct dentry *root; |
90 | int pipefd; | ||
90 | struct file *pipe; | 91 | struct file *pipe; |
91 | pid_t oz_pgrp; | 92 | pid_t oz_pgrp; |
92 | int catatonic; | 93 | int catatonic; |
93 | int version; | 94 | int version; |
94 | int sub_version; | 95 | int sub_version; |
96 | int min_proto; | ||
97 | int max_proto; | ||
95 | unsigned long exp_timeout; | 98 | unsigned long exp_timeout; |
96 | int reghost_enabled; | 99 | int reghost_enabled; |
97 | int needs_reghost; | 100 | int needs_reghost; |
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index 2335b1d6490f..d9a71dab40fc 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
15 | #include <linux/file.h> | 15 | #include <linux/file.h> |
16 | #include <linux/seq_file.h> | ||
16 | #include <linux/pagemap.h> | 17 | #include <linux/pagemap.h> |
17 | #include <linux/parser.h> | 18 | #include <linux/parser.h> |
18 | #include <linux/bitops.h> | 19 | #include <linux/bitops.h> |
@@ -163,9 +164,26 @@ static void autofs4_put_super(struct super_block *sb) | |||
163 | DPRINTK("shutting down"); | 164 | DPRINTK("shutting down"); |
164 | } | 165 | } |
165 | 166 | ||
167 | static int autofs4_show_options(struct seq_file *m, struct vfsmount *mnt) | ||
168 | { | ||
169 | struct autofs_sb_info *sbi = autofs4_sbi(mnt->mnt_sb); | ||
170 | |||
171 | if (!sbi) | ||
172 | return 0; | ||
173 | |||
174 | seq_printf(m, ",fd=%d", sbi->pipefd); | ||
175 | seq_printf(m, ",pgrp=%d", sbi->oz_pgrp); | ||
176 | seq_printf(m, ",timeout=%lu", sbi->exp_timeout/HZ); | ||
177 | seq_printf(m, ",minproto=%d", sbi->min_proto); | ||
178 | seq_printf(m, ",maxproto=%d", sbi->max_proto); | ||
179 | |||
180 | return 0; | ||
181 | } | ||
182 | |||
166 | static struct super_operations autofs4_sops = { | 183 | static struct super_operations autofs4_sops = { |
167 | .put_super = autofs4_put_super, | 184 | .put_super = autofs4_put_super, |
168 | .statfs = simple_statfs, | 185 | .statfs = simple_statfs, |
186 | .show_options = autofs4_show_options, | ||
169 | }; | 187 | }; |
170 | 188 | ||
171 | enum {Opt_err, Opt_fd, Opt_uid, Opt_gid, Opt_pgrp, Opt_minproto, Opt_maxproto}; | 189 | enum {Opt_err, Opt_fd, Opt_uid, Opt_gid, Opt_pgrp, Opt_minproto, Opt_maxproto}; |
@@ -261,7 +279,6 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
261 | int pipefd; | 279 | int pipefd; |
262 | struct autofs_sb_info *sbi; | 280 | struct autofs_sb_info *sbi; |
263 | struct autofs_info *ino; | 281 | struct autofs_info *ino; |
264 | int minproto, maxproto; | ||
265 | 282 | ||
266 | sbi = (struct autofs_sb_info *) kmalloc(sizeof(*sbi), GFP_KERNEL); | 283 | sbi = (struct autofs_sb_info *) kmalloc(sizeof(*sbi), GFP_KERNEL); |
267 | if ( !sbi ) | 284 | if ( !sbi ) |
@@ -273,12 +290,15 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
273 | s->s_fs_info = sbi; | 290 | s->s_fs_info = sbi; |
274 | sbi->magic = AUTOFS_SBI_MAGIC; | 291 | sbi->magic = AUTOFS_SBI_MAGIC; |
275 | sbi->root = NULL; | 292 | sbi->root = NULL; |
293 | sbi->pipefd = -1; | ||
276 | sbi->catatonic = 0; | 294 | sbi->catatonic = 0; |
277 | sbi->exp_timeout = 0; | 295 | sbi->exp_timeout = 0; |
278 | sbi->oz_pgrp = process_group(current); | 296 | sbi->oz_pgrp = process_group(current); |
279 | sbi->sb = s; | 297 | sbi->sb = s; |
280 | sbi->version = 0; | 298 | sbi->version = 0; |
281 | sbi->sub_version = 0; | 299 | sbi->sub_version = 0; |
300 | sbi->min_proto = 0; | ||
301 | sbi->max_proto = 0; | ||
282 | mutex_init(&sbi->wq_mutex); | 302 | mutex_init(&sbi->wq_mutex); |
283 | spin_lock_init(&sbi->fs_lock); | 303 | spin_lock_init(&sbi->fs_lock); |
284 | sbi->queues = NULL; | 304 | sbi->queues = NULL; |
@@ -311,22 +331,26 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
311 | if (parse_options(data, &pipefd, | 331 | if (parse_options(data, &pipefd, |
312 | &root_inode->i_uid, &root_inode->i_gid, | 332 | &root_inode->i_uid, &root_inode->i_gid, |
313 | &sbi->oz_pgrp, | 333 | &sbi->oz_pgrp, |
314 | &minproto, &maxproto)) { | 334 | &sbi->min_proto, &sbi->max_proto)) { |
315 | printk("autofs: called with bogus options\n"); | 335 | printk("autofs: called with bogus options\n"); |
316 | goto fail_dput; | 336 | goto fail_dput; |
317 | } | 337 | } |
318 | 338 | ||
319 | /* Couldn't this be tested earlier? */ | 339 | /* Couldn't this be tested earlier? */ |
320 | if (maxproto < AUTOFS_MIN_PROTO_VERSION || | 340 | if (sbi->max_proto < AUTOFS_MIN_PROTO_VERSION || |
321 | minproto > AUTOFS_MAX_PROTO_VERSION) { | 341 | sbi->min_proto > AUTOFS_MAX_PROTO_VERSION) { |
322 | printk("autofs: kernel does not match daemon version " | 342 | printk("autofs: kernel does not match daemon version " |
323 | "daemon (%d, %d) kernel (%d, %d)\n", | 343 | "daemon (%d, %d) kernel (%d, %d)\n", |
324 | minproto, maxproto, | 344 | sbi->min_proto, sbi->max_proto, |
325 | AUTOFS_MIN_PROTO_VERSION, AUTOFS_MAX_PROTO_VERSION); | 345 | AUTOFS_MIN_PROTO_VERSION, AUTOFS_MAX_PROTO_VERSION); |
326 | goto fail_dput; | 346 | goto fail_dput; |
327 | } | 347 | } |
328 | 348 | ||
329 | sbi->version = maxproto > AUTOFS_MAX_PROTO_VERSION ? AUTOFS_MAX_PROTO_VERSION : maxproto; | 349 | /* Establish highest kernel protocol version */ |
350 | if (sbi->max_proto > AUTOFS_MAX_PROTO_VERSION) | ||
351 | sbi->version = AUTOFS_MAX_PROTO_VERSION; | ||
352 | else | ||
353 | sbi->version = sbi->max_proto; | ||
330 | sbi->sub_version = AUTOFS_PROTO_SUBVERSION; | 354 | sbi->sub_version = AUTOFS_PROTO_SUBVERSION; |
331 | 355 | ||
332 | DPRINTK("pipe fd = %d, pgrp = %u", pipefd, sbi->oz_pgrp); | 356 | DPRINTK("pipe fd = %d, pgrp = %u", pipefd, sbi->oz_pgrp); |
@@ -339,6 +363,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
339 | if ( !pipe->f_op || !pipe->f_op->write ) | 363 | if ( !pipe->f_op || !pipe->f_op->write ) |
340 | goto fail_fput; | 364 | goto fail_fput; |
341 | sbi->pipe = pipe; | 365 | sbi->pipe = pipe; |
366 | sbi->pipefd = pipefd; | ||
342 | 367 | ||
343 | /* | 368 | /* |
344 | * Take a reference to the root dentry so we get a chance to | 369 | * Take a reference to the root dentry so we get a chance to |