Skip to content

Commit 092a534

Browse files
raven-autorvalds
authored andcommitted
autofs: take more care to not update last_used on path walk
GUI environments seem to be becoming more agressive at scanning filesystems, to the point where autofs cannot expire mounts at all. This is one key reason the update of the autofs dentry info last_used field is done in the expire system when the dentry is seen to be in use. But somewhere along the way instances of the update has crept back into the autofs path walk functions which, with the more aggressive file access patterns, is preventing expiration. Changing the update in the path walk functions allows autofs to at least make progress in spite of frequent immediate re-mounts from file accesses. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ian Kent <[email protected]> Cc: Tomohiro Kusumi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 3bb2fbd commit 092a534

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

fs/autofs4/root.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,8 @@ static int autofs4_mount_wait(const struct path *path, bool rcu_walk)
281281
pr_debug("waiting for mount name=%pd\n", path->dentry);
282282
status = autofs4_wait(sbi, path, NFY_MOUNT);
283283
pr_debug("mount wait done status=%d\n", status);
284+
ino->last_used = jiffies;
284285
}
285-
ino->last_used = jiffies;
286286
return status;
287287
}
288288

@@ -321,16 +321,21 @@ static struct dentry *autofs4_mountpoint_changed(struct path *path)
321321
*/
322322
if (autofs_type_indirect(sbi->type) && d_unhashed(dentry)) {
323323
struct dentry *parent = dentry->d_parent;
324-
struct autofs_info *ino;
325324
struct dentry *new;
326325

327326
new = d_lookup(parent, &dentry->d_name);
328327
if (!new)
329328
return NULL;
330-
ino = autofs4_dentry_ino(new);
331-
ino->last_used = jiffies;
332-
dput(path->dentry);
333-
path->dentry = new;
329+
if (new == dentry)
330+
dput(new);
331+
else {
332+
struct autofs_info *ino;
333+
334+
ino = autofs4_dentry_ino(new);
335+
ino->last_used = jiffies;
336+
dput(path->dentry);
337+
path->dentry = new;
338+
}
334339
}
335340
return path->dentry;
336341
}

0 commit comments

Comments
 (0)