aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/autofs4/expire.c13
-rw-r--r--fs/autofs4/root.c35
2 files changed, 14 insertions, 34 deletions
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c
index f43100b9662b..c896dd6c1ea9 100644
--- a/fs/autofs4/expire.c
+++ b/fs/autofs4/expire.c
@@ -294,7 +294,6 @@ struct dentry *autofs4_expire_direct(struct super_block *sb,
294 spin_unlock(&sbi->fs_lock); 294 spin_unlock(&sbi->fs_lock);
295 return NULL; 295 return NULL;
296 } 296 }
297 managed_dentry_set_transit(root);
298 if (!autofs4_direct_busy(mnt, root, timeout, do_now)) { 297 if (!autofs4_direct_busy(mnt, root, timeout, do_now)) {
299 struct autofs_info *ino = autofs4_dentry_ino(root); 298 struct autofs_info *ino = autofs4_dentry_ino(root);
300 ino->flags |= AUTOFS_INF_EXPIRING; 299 ino->flags |= AUTOFS_INF_EXPIRING;
@@ -302,7 +301,6 @@ struct dentry *autofs4_expire_direct(struct super_block *sb,
302 spin_unlock(&sbi->fs_lock); 301 spin_unlock(&sbi->fs_lock);
303 return root; 302 return root;
304 } 303 }
305 managed_dentry_clear_transit(root);
306 spin_unlock(&sbi->fs_lock); 304 spin_unlock(&sbi->fs_lock);
307 dput(root); 305 dput(root);
308 306
@@ -341,8 +339,7 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb,
341 ino = autofs4_dentry_ino(dentry); 339 ino = autofs4_dentry_ino(dentry);
342 /* No point expiring a pending mount */ 340 /* No point expiring a pending mount */
343 if (ino->flags & AUTOFS_INF_PENDING) 341 if (ino->flags & AUTOFS_INF_PENDING)
344 goto cont; 342 goto next;
345 managed_dentry_set_transit(dentry);
346 343
347 /* 344 /*
348 * Case 1: (i) indirect mount or top level pseudo direct mount 345 * Case 1: (i) indirect mount or top level pseudo direct mount
@@ -402,8 +399,6 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb,
402 } 399 }
403 } 400 }
404next: 401next:
405 managed_dentry_clear_transit(dentry);
406cont:
407 spin_unlock(&sbi->fs_lock); 402 spin_unlock(&sbi->fs_lock);
408 } 403 }
409 return NULL; 404 return NULL;
@@ -484,8 +479,6 @@ int autofs4_expire_run(struct super_block *sb,
484 spin_lock(&sbi->fs_lock); 479 spin_lock(&sbi->fs_lock);
485 ino = autofs4_dentry_ino(dentry); 480 ino = autofs4_dentry_ino(dentry);
486 ino->flags &= ~AUTOFS_INF_EXPIRING; 481 ino->flags &= ~AUTOFS_INF_EXPIRING;
487 if (!d_unhashed(dentry))
488 managed_dentry_clear_transit(dentry);
489 complete_all(&ino->expire_complete); 482 complete_all(&ino->expire_complete);
490 spin_unlock(&sbi->fs_lock); 483 spin_unlock(&sbi->fs_lock);
491 484
@@ -513,9 +506,7 @@ int autofs4_do_expire_multi(struct super_block *sb, struct vfsmount *mnt,
513 spin_lock(&sbi->fs_lock); 506 spin_lock(&sbi->fs_lock);
514 ino->flags &= ~AUTOFS_INF_EXPIRING; 507 ino->flags &= ~AUTOFS_INF_EXPIRING;
515 spin_lock(&dentry->d_lock); 508 spin_lock(&dentry->d_lock);
516 if (ret) 509 if (!ret) {
517 __managed_dentry_clear_transit(dentry);
518 else {
519 if ((IS_ROOT(dentry) || 510 if ((IS_ROOT(dentry) ||
520 (autofs_type_indirect(sbi->type) && 511 (autofs_type_indirect(sbi->type) &&
521 IS_ROOT(dentry->d_parent))) && 512 IS_ROOT(dentry->d_parent))) &&
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
291static int do_expire_wait(struct dentry *dentry) 290static 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)
418done: 408done:
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)))