/* Check a mount point for busyness */
static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry)
{
+ struct dentry *top = dentry;
int status = 1;
DPRINTK("dentry %p %.*s",
if (is_autofs4_dentry(dentry))
goto done;
- /* The big question */
- if (may_umount_tree(mnt) == 0)
- status = 0;
+ /* Update the expiry counter if fs is busy */
+ if (may_umount_tree(mnt)) {
+ struct autofs_info *ino = autofs4_dentry_ino(top);
+ ino->last_used = jiffies;
+ goto done;
+ }
+
+ status = 0;
done:
DPRINTK("returning = %d", status);
mntput(mnt);
unsigned long timeout,
int do_now)
{
- struct autofs_info *ino;
+ struct autofs_info *top_ino = autofs4_dentry_ino(top);
struct dentry *p;
DPRINTK("top %p %.*s",
* Is someone visiting anywhere in the subtree ?
* If there's no mount we need to check the usage
* count for the autofs dentry.
+ * If the fs is busy update the expiry counter.
*/
- ino = autofs4_dentry_ino(p);
if (d_mountpoint(p)) {
if (autofs4_mount_busy(mnt, p)) {
+ top_ino->last_used = jiffies;
dput(p);
return 1;
}
} else {
+ struct autofs_info *ino = autofs4_dentry_ino(p);
unsigned int ino_count = atomic_read(&ino->count);
/* allow for dget above and top is already dgot */
ino_count++;
if (atomic_read(&p->d_count) > ino_count) {
+ top_ino->last_used = jiffies;
dput(p);
return 1;
}
spin_unlock(&dcache_lock);
if (d_mountpoint(p)) {
- /* Can we expire this guy */
- if (!autofs4_can_expire(p, timeout, do_now))
+ /* Can we umount this guy */
+ if (autofs4_mount_busy(mnt, p))
goto cont;
- /* Can we umount this guy */
- if (!autofs4_mount_busy(mnt, p))
+ /* Can we expire this guy */
+ if (autofs4_can_expire(p, timeout, do_now))
return p;
-
}
cont:
dput(p);
DPRINTK("checking mountpoint %p %.*s",
dentry, (int)dentry->d_name.len, dentry->d_name.name);
- /* Can we expire this guy */
- if (!autofs4_can_expire(dentry, timeout, do_now))
+ /* Can we umount this guy */
+ if (autofs4_mount_busy(mnt, dentry))
goto next;
- /* Can we umount this guy */
- if (!autofs4_mount_busy(mnt, dentry)) {
+ /* Can we expire this guy */
+ if (autofs4_can_expire(dentry, timeout, do_now)) {
expired = dentry;
break;
}