Skip to content

Commit f516221

Browse files
raven-autorvalds
authored andcommitted
autofs: add strictexpire mount option
Commit 092a534 ("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 <[email protected]> Cc: Al Viro <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 9d8719a commit f516221

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

fs/autofs/autofs_i.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ struct autofs_wait_queue {
104104
#define AUTOFS_SBI_MAGIC 0x6d4a556d
105105

106106
#define AUTOFS_SBI_CATATONIC 0x0001
107+
#define AUTOFS_SBI_STRICTEXPIRE 0x0002
107108

108109
struct autofs_sb_info {
109110
u32 magic;

fs/autofs/inode.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ static int autofs_show_options(struct seq_file *m, struct dentry *root)
8787
seq_printf(m, ",direct");
8888
else
8989
seq_printf(m, ",indirect");
90+
if (sbi->flags & AUTOFS_SBI_STRICTEXPIRE)
91+
seq_printf(m, ",strictexpire");
9092
#ifdef CONFIG_CHECKPOINT_RESTORE
9193
if (sbi->pipe)
9294
seq_printf(m, ",pipe_ino=%ld", file_inode(sbi->pipe)->i_ino);
@@ -109,7 +111,7 @@ static const struct super_operations autofs_sops = {
109111
};
110112

111113
enum {Opt_err, Opt_fd, Opt_uid, Opt_gid, Opt_pgrp, Opt_minproto, Opt_maxproto,
112-
Opt_indirect, Opt_direct, Opt_offset};
114+
Opt_indirect, Opt_direct, Opt_offset, Opt_strictexpire};
113115

114116
static const match_table_t tokens = {
115117
{Opt_fd, "fd=%u"},
@@ -121,6 +123,7 @@ static const match_table_t tokens = {
121123
{Opt_indirect, "indirect"},
122124
{Opt_direct, "direct"},
123125
{Opt_offset, "offset"},
126+
{Opt_strictexpire, "strictexpire"},
124127
{Opt_err, NULL}
125128
};
126129

@@ -200,6 +203,9 @@ static int parse_options(char *options,
200203
case Opt_offset:
201204
set_autofs_type_offset(&sbi->type);
202205
break;
206+
case Opt_strictexpire:
207+
sbi->flags |= AUTOFS_SBI_STRICTEXPIRE;
208+
break;
203209
default:
204210
return 1;
205211
}

fs/autofs/root.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,11 @@ static int autofs_mount_wait(const struct path *path, bool rcu_walk)
275275
pr_debug("waiting for mount name=%pd\n", path->dentry);
276276
status = autofs_wait(sbi, path, NFY_MOUNT);
277277
pr_debug("mount wait done status=%d\n", status);
278+
ino->last_used = jiffies;
279+
return status;
278280
}
279-
ino->last_used = jiffies;
281+
if (!(sbi->flags & AUTOFS_SBI_STRICTEXPIRE))
282+
ino->last_used = jiffies;
280283
return status;
281284
}
282285

include/uapi/linux/auto_fs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#define AUTOFS_MIN_PROTO_VERSION 3
2424
#define AUTOFS_MAX_PROTO_VERSION 5
2525

26-
#define AUTOFS_PROTO_SUBVERSION 3
26+
#define AUTOFS_PROTO_SUBVERSION 4
2727

2828
/*
2929
* The wait_queue_token (autofs_wqt_t) is part of a structure which is passed

0 commit comments

Comments
 (0)