]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/autofs4/waitq.c
Merge branch 'build_fix' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh...
[linux-2.6-omap-h63xx.git] / fs / autofs4 / waitq.c
index 3458dbc8fff0b1b7f2b709c819fab9cd1971977c..35216d18d8b56fa5a6b0ff8f07f37771698a0b75 100644 (file)
@@ -328,6 +328,21 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
        if (sbi->catatonic)
                return -ENOENT;
 
+       if (!dentry->d_inode) {
+               /*
+                * A wait for a negative dentry is invalid for certain
+                * cases. A direct or offset mount "always" has its mount
+                * point directory created and so the request dentry must
+                * be positive or the map key doesn't exist. The situation
+                * is very similar for indirect mounts except only dentrys
+                * in the root of the autofs file system may be negative.
+                */
+               if (sbi->type & (AUTOFS_TYPE_DIRECT|AUTOFS_TYPE_OFFSET))
+                       return -ENOENT;
+               else if (!IS_ROOT(dentry->d_parent))
+                       return -ENOENT;
+       }
+
        name = kmalloc(NAME_MAX + 1, GFP_KERNEL);
        if (!name)
                return -ENOMEM;