Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

autofs: add strictexpire mount option

Commit 092a53452bb7 ("autofs: take more care to not update last_used on
path walk") helped to (partially) resolve a problem where automounts
were not expiring due to aggressive accesses from user space.

This patch was later reverted because, for very large environments, it
meant more mount requests from clients and when there are a lot of
clients this caused a fairly significant increase in server load.

But there is a need for both types of expire check, depending on use
case, so add a mount option to allow for strict update of last use of
autofs dentrys (which just means not updating the last use on path walk
access).

Link: http://lkml.kernel.org/r/154296973880.9889.14085372741514507967.stgit@pluto-themaw-net
Signed-off-by: Ian Kent <raven@themaw.net>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Ian Kent and committed by
Linus Torvalds
f5162216 9d8719a4

+13 -3
+1
fs/autofs/autofs_i.h
··· 104 104 #define AUTOFS_SBI_MAGIC 0x6d4a556d 105 105 106 106 #define AUTOFS_SBI_CATATONIC 0x0001 107 + #define AUTOFS_SBI_STRICTEXPIRE 0x0002 107 108 108 109 struct autofs_sb_info { 109 110 u32 magic;
+7 -1
fs/autofs/inode.c
··· 87 87 seq_printf(m, ",direct"); 88 88 else 89 89 seq_printf(m, ",indirect"); 90 + if (sbi->flags & AUTOFS_SBI_STRICTEXPIRE) 91 + seq_printf(m, ",strictexpire"); 90 92 #ifdef CONFIG_CHECKPOINT_RESTORE 91 93 if (sbi->pipe) 92 94 seq_printf(m, ",pipe_ino=%ld", file_inode(sbi->pipe)->i_ino); ··· 111 109 }; 112 110 113 111 enum {Opt_err, Opt_fd, Opt_uid, Opt_gid, Opt_pgrp, Opt_minproto, Opt_maxproto, 114 - Opt_indirect, Opt_direct, Opt_offset}; 112 + Opt_indirect, Opt_direct, Opt_offset, Opt_strictexpire}; 115 113 116 114 static const match_table_t tokens = { 117 115 {Opt_fd, "fd=%u"}, ··· 123 121 {Opt_indirect, "indirect"}, 124 122 {Opt_direct, "direct"}, 125 123 {Opt_offset, "offset"}, 124 + {Opt_strictexpire, "strictexpire"}, 126 125 {Opt_err, NULL} 127 126 }; 128 127 ··· 202 199 break; 203 200 case Opt_offset: 204 201 set_autofs_type_offset(&sbi->type); 202 + break; 203 + case Opt_strictexpire: 204 + sbi->flags |= AUTOFS_SBI_STRICTEXPIRE; 205 205 break; 206 206 default: 207 207 return 1;
+4 -1
fs/autofs/root.c
··· 275 275 pr_debug("waiting for mount name=%pd\n", path->dentry); 276 276 status = autofs_wait(sbi, path, NFY_MOUNT); 277 277 pr_debug("mount wait done status=%d\n", status); 278 + ino->last_used = jiffies; 279 + return status; 278 280 } 279 - ino->last_used = jiffies; 281 + if (!(sbi->flags & AUTOFS_SBI_STRICTEXPIRE)) 282 + ino->last_used = jiffies; 280 283 return status; 281 284 } 282 285
+1 -1
include/uapi/linux/auto_fs.h
··· 23 23 #define AUTOFS_MIN_PROTO_VERSION 3 24 24 #define AUTOFS_MAX_PROTO_VERSION 5 25 25 26 - #define AUTOFS_PROTO_SUBVERSION 3 26 + #define AUTOFS_PROTO_SUBVERSION 4 27 27 28 28 /* 29 29 * The wait_queue_token (autofs_wqt_t) is part of a structure which is passed