summaryrefslogtreecommitdiffstats
path: root/fs/autofs4
diff options
context:
space:
mode:
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>2016-10-11 16:52:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-11 18:06:31 -0400
commit749800ef537848b9569da9bb1463f1de4b96c0a4 (patch)
tree6c724282d79559e78c41ed2c1403852525cb02f8 /fs/autofs4
parent4a44c1859ffd9926ba4d47d1b538d119065ec2f5 (diff)
autofs: test autofs versions first on sb initialization
This patch does what the below comment says. It could be and it's considered better to do this first before various functions get called during initialization. /* Couldn't this be tested earlier? */ Link: http://lkml.kernel.org/r/20160812024744.12352.43075.stgit@pluto.themaw.net Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com> Signed-off-by: Ian Kent <raven@themaw.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/autofs4')
-rw-r--r--fs/autofs4/inode.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index ca9cbd6362e0..d76573f62278 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -274,6 +274,23 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
274 goto fail_dput; 274 goto fail_dput;
275 } 275 }
276 276
277 /* Test versions first */
278 if (sbi->max_proto < AUTOFS_MIN_PROTO_VERSION ||
279 sbi->min_proto > AUTOFS_MAX_PROTO_VERSION) {
280 pr_err("kernel does not match daemon version "
281 "daemon (%d, %d) kernel (%d, %d)\n",
282 sbi->min_proto, sbi->max_proto,
283 AUTOFS_MIN_PROTO_VERSION, AUTOFS_MAX_PROTO_VERSION);
284 goto fail_dput;
285 }
286
287 /* Establish highest kernel protocol version */
288 if (sbi->max_proto > AUTOFS_MAX_PROTO_VERSION)
289 sbi->version = AUTOFS_MAX_PROTO_VERSION;
290 else
291 sbi->version = sbi->max_proto;
292 sbi->sub_version = AUTOFS_PROTO_SUBVERSION;
293
277 if (pgrp_set) { 294 if (pgrp_set) {
278 sbi->oz_pgrp = find_get_pid(pgrp); 295 sbi->oz_pgrp = find_get_pid(pgrp);
279 if (!sbi->oz_pgrp) { 296 if (!sbi->oz_pgrp) {
@@ -291,23 +308,6 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
291 root_inode->i_fop = &autofs4_root_operations; 308 root_inode->i_fop = &autofs4_root_operations;
292 root_inode->i_op = &autofs4_dir_inode_operations; 309 root_inode->i_op = &autofs4_dir_inode_operations;
293 310
294 /* Couldn't this be tested earlier? */
295 if (sbi->max_proto < AUTOFS_MIN_PROTO_VERSION ||
296 sbi->min_proto > AUTOFS_MAX_PROTO_VERSION) {
297 pr_err("kernel does not match daemon version "
298 "daemon (%d, %d) kernel (%d, %d)\n",
299 sbi->min_proto, sbi->max_proto,
300 AUTOFS_MIN_PROTO_VERSION, AUTOFS_MAX_PROTO_VERSION);
301 goto fail_dput;
302 }
303
304 /* Establish highest kernel protocol version */
305 if (sbi->max_proto > AUTOFS_MAX_PROTO_VERSION)
306 sbi->version = AUTOFS_MAX_PROTO_VERSION;
307 else
308 sbi->version = sbi->max_proto;
309 sbi->sub_version = AUTOFS_PROTO_SUBVERSION;
310
311 pr_debug("pipe fd = %d, pgrp = %u\n", pipefd, pid_nr(sbi->oz_pgrp)); 311 pr_debug("pipe fd = %d, pgrp = %u\n", pipefd, pid_nr(sbi->oz_pgrp));
312 pipe = fget(pipefd); 312 pipe = fget(pipefd);
313 313