/* The daemon never waits. */
        if (autofs4_oz_mode(sbi)) {
-               if (rcu_walk)
-                       return 0;
                if (!d_mountpoint(dentry))
                        return -EISDIR;
                return 0;
        if (status)
                return status;
 
-       if (rcu_walk)
-               /* it is always safe to return 0 as the worst that
-                * will happen is we retry in REF-walk mode.
-                * Better than always taking a lock.
+       if (rcu_walk) {
+               /* We don't need fs_lock in rcu_walk mode,
+                * just testing 'AUTOFS_INFO_NO_RCU' is enough.
+                * simple_empty() takes a spinlock, so leave it
+                * to last.
+                * We only return -EISDIR when certain this isn't
+                * a mount-trap.
                 */
+               struct inode *inode;
+               if (ino->flags & (AUTOFS_INF_EXPIRING | AUTOFS_INF_NO_RCU))
+                       return 0;
+               if (d_mountpoint(dentry))
+                       return 0;
+               inode = ACCESS_ONCE(dentry->d_inode);
+               if (inode && S_ISLNK(inode->i_mode))
+                       return -EISDIR;
+               if (list_empty(&dentry->d_subdirs))
+                       return 0;
+               if (!simple_empty(dentry))
+                       return -EISDIR;
                return 0;
+       }
 
        spin_lock(&sbi->fs_lock);
        /*