diff options
-rw-r--r-- | fs/autofs4/waitq.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index bcb6c5265467..35216d18d8b5 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c | |||
@@ -328,9 +328,20 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, | |||
328 | if (sbi->catatonic) | 328 | if (sbi->catatonic) |
329 | return -ENOENT; | 329 | return -ENOENT; |
330 | 330 | ||
331 | if (!dentry->d_inode && | 331 | if (!dentry->d_inode) { |
332 | (sbi->type & (AUTOFS_TYPE_DIRECT | AUTOFS_TYPE_OFFSET))) | 332 | /* |
333 | return -ENOENT; | 333 | * A wait for a negative dentry is invalid for certain |
334 | * cases. A direct or offset mount "always" has its mount | ||
335 | * point directory created and so the request dentry must | ||
336 | * be positive or the map key doesn't exist. The situation | ||
337 | * is very similar for indirect mounts except only dentrys | ||
338 | * in the root of the autofs file system may be negative. | ||
339 | */ | ||
340 | if (sbi->type & (AUTOFS_TYPE_DIRECT|AUTOFS_TYPE_OFFSET)) | ||
341 | return -ENOENT; | ||
342 | else if (!IS_ROOT(dentry->d_parent)) | ||
343 | return -ENOENT; | ||
344 | } | ||
334 | 345 | ||
335 | name = kmalloc(NAME_MAX + 1, GFP_KERNEL); | 346 | name = kmalloc(NAME_MAX + 1, GFP_KERNEL); |
336 | if (!name) | 347 | if (!name) |