From 1a3d79a3e9fc08b8da2dc426aab92634b8358ef7 Mon Sep 17 00:00:00 2001 From: Ian Kent Date: Wed, 23 Jul 2008 21:30:23 -0700 Subject: [PATCH] --- yaml --- r: 105468 b: refs/heads/master c: c72305b5472522299bb6f45b736080128eb1c822 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/autofs4/waitq.c | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index b0d9a507ef5b..d394f89b6741 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: eb3b176796b0e53fd26fce86847231542eb0d198 +refs/heads/master: c72305b5472522299bb6f45b736080128eb1c822 diff --git a/trunk/fs/autofs4/waitq.c b/trunk/fs/autofs4/waitq.c index bcb6c5265467..35216d18d8b5 100644 --- a/trunk/fs/autofs4/waitq.c +++ b/trunk/fs/autofs4/waitq.c @@ -328,9 +328,20 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, if (sbi->catatonic) return -ENOENT; - if (!dentry->d_inode && - (sbi->type & (AUTOFS_TYPE_DIRECT | AUTOFS_TYPE_OFFSET))) - 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)