patch-2.3.99-pre7 linux/fs/autofs/dirhash.c

Next file: linux/fs/autofs/root.c
Previous file: linux/fs/autofs/autofs_i.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre6/linux/fs/autofs/dirhash.c linux/fs/autofs/dirhash.c
@@ -34,7 +34,8 @@
 }
 
 struct autofs_dir_ent *autofs_expire(struct super_block *sb,
-				     struct autofs_sb_info *sbi)
+				     struct autofs_sb_info *sbi,
+				     struct vfsmount *mnt)
 {
 	struct autofs_dirhash *dh = &sbi->dirhash;
 	struct autofs_dir_ent *ent;
@@ -79,12 +80,25 @@
 			DPRINTK(("autofs: not expirable (not a mounted directory): %s\n", ent->name));
 			continue;
 		}
+		mntget(mnt);
+		dget(dentry);
+		if (!follow_down(&mnt, &dentry)) {
+			dput(dentry);
+			mntput(mnt);
+			DPRINTK(("autofs: not expirable (not a mounted directory): %s\n", ent->name));
+			continue;
+		}
+		while (d_mountpoint(dentry) && follow_down(&mnt, &dentry))
+			;
+		dput(dentry);
 
-		if ( !is_root_busy(dentry->d_mounts) ) {
+		if ( may_umount(mnt) == 0 ) {
+			mntput(mnt);
 			DPRINTK(("autofs: signaling expire on %s\n", ent->name));
 			return ent; /* Expirable! */
 		}
-		DPRINTK(("autofs: didn't expire due to is_root_busy: %s\n", ent->name));
+		DPRINTK(("autofs: didn't expire due to may_umount: %s\n", ent->name));
+		mntput(mnt);
 	}
 	return NULL;		/* No expirable entries */
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)