X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=fs%2Fautofs4%2Fwaitq.c;h=6d87bb15632613028397c92aaa55c047b3ca5802;hb=bb979d7fc360bc37cbaff43a6fafceb897cb5e47;hp=bcb6c5265467f4306721848e7076b327f0151aa2;hpb=eb3b176796b0e53fd26fce86847231542eb0d198;p=linux-2.6-omap-h63xx.git diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index bcb6c526546..6d87bb15632 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c @@ -328,16 +328,27 @@ 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_TRIGGER) + return -ENOENT; + else if (!IS_ROOT(dentry->d_parent)) + return -ENOENT; + } name = kmalloc(NAME_MAX + 1, GFP_KERNEL); if (!name) return -ENOMEM; /* If this is a direct mount request create a dummy name */ - if (IS_ROOT(dentry) && (sbi->type & AUTOFS_TYPE_DIRECT)) + if (IS_ROOT(dentry) && sbi->type & AUTOFS_TYPE_TRIGGER) qstr.len = sprintf(name, "%p", dentry); else { qstr.len = autofs4_getpath(sbi, dentry, &name); @@ -395,11 +406,11 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, type = autofs_ptype_expire_multi; } else { if (notify == NFY_MOUNT) - type = (sbi->type & AUTOFS_TYPE_DIRECT) ? + type = (sbi->type & AUTOFS_TYPE_TRIGGER) ? autofs_ptype_missing_direct : autofs_ptype_missing_indirect; else - type = (sbi->type & AUTOFS_TYPE_DIRECT) ? + type = (sbi->type & AUTOFS_TYPE_TRIGGER) ? autofs_ptype_expire_direct : autofs_ptype_expire_indirect; }