]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/autofs4/expire.c
autofs4: correct offset mount expire check
[linux-2.6-omap-h63xx.git] / fs / autofs4 / expire.c
index cde2f8e8935a680bd62243dcc4b92f6909ea7789..4b6fb3f628c04be94a2863ad5f7ee05feace9c44 100644 (file)
@@ -56,12 +56,23 @@ static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry)
        mntget(mnt);
        dget(dentry);
 
-       if (!autofs4_follow_mount(&mnt, &dentry))
+       if (!follow_down(&mnt, &dentry))
                goto done;
 
-       /* This is an autofs submount, we can't expire it */
-       if (is_autofs4_dentry(dentry))
-               goto done;
+       if (is_autofs4_dentry(dentry)) {
+               struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
+
+               /* This is an autofs submount, we can't expire it */
+               if (sbi->type == AUTOFS_TYPE_INDIRECT)
+                       goto done;
+
+               /*
+                * Otherwise it's an offset mount and we need to check
+                * if we can umount its mount, if there is one.
+                */
+               if (!d_mountpoint(dentry))
+                       goto done;
+       }
 
        /* Update the expiry counter if fs is busy */
        if (!may_umount_tree(mnt)) {