diff options
author | Ian Kent <raven@themaw.net> | 2011-03-24 13:51:08 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-03-24 14:54:34 -0400 |
commit | 3c3199852905ceb90a70e98777e71d369a5f0823 (patch) | |
tree | aec40f3721955394587fc4ad364606161bc98cc5 /fs/autofs4/root.c | |
parent | 62a7375e5d77d654695297c4b39d5d740d901184 (diff) |
autofs4 - reinstate last used update on access
When direct (and offset) mounts were introduced the the last used
timeout could no longer be updated in ->d_revalidate(). This is
because covered direct mounts would be followed over without calling
the autofs file system. As a result the definition of the busyness
check for all entries was changed to be "actually busy" being an open
file or working directory within the automount. But now we have a call
back in the follow so the last used update on any access can be
re-instated. This requires DCACHE_MANAGE_TRANSIT to always be set.
Signed-off-by: Ian Kent <raven@themaw.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/autofs4/root.c')
-rw-r--r-- | fs/autofs4/root.c | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index e6f84d26f4cf..3a93d3552486 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -275,17 +275,16 @@ static int autofs4_mount_wait(struct dentry *dentry) | |||
275 | { | 275 | { |
276 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); | 276 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); |
277 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 277 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
278 | int status; | 278 | int status = 0; |
279 | 279 | ||
280 | if (ino->flags & AUTOFS_INF_PENDING) { | 280 | if (ino->flags & AUTOFS_INF_PENDING) { |
281 | DPRINTK("waiting for mount name=%.*s", | 281 | DPRINTK("waiting for mount name=%.*s", |
282 | dentry->d_name.len, dentry->d_name.name); | 282 | dentry->d_name.len, dentry->d_name.name); |
283 | status = autofs4_wait(sbi, dentry, NFY_MOUNT); | 283 | status = autofs4_wait(sbi, dentry, NFY_MOUNT); |
284 | DPRINTK("mount wait done status=%d", status); | 284 | DPRINTK("mount wait done status=%d", status); |
285 | ino->last_used = jiffies; | ||
286 | return status; | ||
287 | } | 285 | } |
288 | return 0; | 286 | ino->last_used = jiffies; |
287 | return status; | ||
289 | } | 288 | } |
290 | 289 | ||
291 | static int do_expire_wait(struct dentry *dentry) | 290 | static int do_expire_wait(struct dentry *dentry) |
@@ -319,9 +318,12 @@ static struct dentry *autofs4_mountpoint_changed(struct path *path) | |||
319 | */ | 318 | */ |
320 | if (autofs_type_indirect(sbi->type) && d_unhashed(dentry)) { | 319 | if (autofs_type_indirect(sbi->type) && d_unhashed(dentry)) { |
321 | struct dentry *parent = dentry->d_parent; | 320 | struct dentry *parent = dentry->d_parent; |
321 | struct autofs_info *ino; | ||
322 | struct dentry *new = d_lookup(parent, &dentry->d_name); | 322 | struct dentry *new = d_lookup(parent, &dentry->d_name); |
323 | if (!new) | 323 | if (!new) |
324 | return NULL; | 324 | return NULL; |
325 | ino = autofs4_dentry_ino(new); | ||
326 | ino->last_used = jiffies; | ||
325 | dput(path->dentry); | 327 | dput(path->dentry); |
326 | path->dentry = new; | 328 | path->dentry = new; |
327 | } | 329 | } |
@@ -338,18 +340,6 @@ static struct vfsmount *autofs4_d_automount(struct path *path) | |||
338 | DPRINTK("dentry=%p %.*s", | 340 | DPRINTK("dentry=%p %.*s", |
339 | dentry, dentry->d_name.len, dentry->d_name.name); | 341 | dentry, dentry->d_name.len, dentry->d_name.name); |
340 | 342 | ||
341 | /* | ||
342 | * Someone may have manually umounted this or it was a submount | ||
343 | * that has gone away. | ||
344 | */ | ||
345 | spin_lock(&dentry->d_lock); | ||
346 | if (!d_mountpoint(dentry) && list_empty(&dentry->d_subdirs)) { | ||
347 | if (!(dentry->d_flags & DCACHE_MANAGE_TRANSIT) && | ||
348 | (dentry->d_flags & DCACHE_NEED_AUTOMOUNT)) | ||
349 | __managed_dentry_set_transit(path->dentry); | ||
350 | } | ||
351 | spin_unlock(&dentry->d_lock); | ||
352 | |||
353 | /* The daemon never triggers a mount. */ | 343 | /* The daemon never triggers a mount. */ |
354 | if (autofs4_oz_mode(sbi)) | 344 | if (autofs4_oz_mode(sbi)) |
355 | return NULL; | 345 | return NULL; |
@@ -418,18 +408,17 @@ static struct vfsmount *autofs4_d_automount(struct path *path) | |||
418 | done: | 408 | done: |
419 | if (!(ino->flags & AUTOFS_INF_EXPIRING)) { | 409 | if (!(ino->flags & AUTOFS_INF_EXPIRING)) { |
420 | /* | 410 | /* |
421 | * Any needed mounting has been completed and the path updated | 411 | * Any needed mounting has been completed and the path |
422 | * so turn this into a normal dentry so we don't continually | 412 | * updated so clear DCACHE_NEED_AUTOMOUNT so we don't |
423 | * call ->d_automount() and ->d_manage(). | 413 | * call ->d_automount() on rootless multi-mounts since |
424 | */ | 414 | * it can lead to an incorrect ELOOP error return. |
425 | spin_lock(&dentry->d_lock); | 415 | * |
426 | __managed_dentry_clear_transit(dentry); | ||
427 | /* | ||
428 | * Only clear DMANAGED_AUTOMOUNT for rootless multi-mounts and | 416 | * Only clear DMANAGED_AUTOMOUNT for rootless multi-mounts and |
429 | * symlinks as in all other cases the dentry will be covered by | 417 | * symlinks as in all other cases the dentry will be covered by |
430 | * an actual mount so ->d_automount() won't be called during | 418 | * an actual mount so ->d_automount() won't be called during |
431 | * the follow. | 419 | * the follow. |
432 | */ | 420 | */ |
421 | spin_lock(&dentry->d_lock); | ||
433 | if ((!d_mountpoint(dentry) && | 422 | if ((!d_mountpoint(dentry) && |
434 | !list_empty(&dentry->d_subdirs)) || | 423 | !list_empty(&dentry->d_subdirs)) || |
435 | (dentry->d_inode && S_ISLNK(dentry->d_inode->i_mode))) | 424 | (dentry->d_inode && S_ISLNK(dentry->d_inode->i_mode))) |