aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4/root.c
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2006-09-27 04:50:44 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-27 11:26:17 -0400
commitbcdc5e019d9f525a9f181a7de642d3a9c27c7610 (patch)
treec2a93b8456095b260bee2be6e169c116f4b0be84 /fs/autofs4/root.c
parent1183dc943cae8b0fddca0b310c26052b2355e04b (diff)
[PATCH] autofs4 needs to force fail return revalidate
For a long time now I have had a problem with not being able to return a lookup failure on an existsing directory. In autofs this corresponds to a mount failure on a autofs managed mount entry that is browsable (and so the mount point directory exists). While this problem has been present for a long time I've avoided resolving it because it was not very visible. But now that autofs v5 has "mount and expire on demand" of nested multiple mounts, such as is found when mounting an export list from a server, solving the problem cannot be avoided any longer. I've tried very hard to find a way to do this entirely within the autofs4 module but have not been able to find a satisfactory way to achieve it. So, I need to propose a change to the VFS. Signed-off-by: Ian Kent <raven@themaw.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/autofs4/root.c')
-rw-r--r--fs/autofs4/root.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 5100f984783f..27e17f96cada 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -137,7 +137,9 @@ static int autofs4_dir_open(struct inode *inode, struct file *file)
137 nd.flags = LOOKUP_DIRECTORY; 137 nd.flags = LOOKUP_DIRECTORY;
138 ret = (dentry->d_op->d_revalidate)(dentry, &nd); 138 ret = (dentry->d_op->d_revalidate)(dentry, &nd);
139 139
140 if (!ret) { 140 if (ret <= 0) {
141 if (ret < 0)
142 status = ret;
141 dcache_dir_close(inode, file); 143 dcache_dir_close(inode, file);
142 goto out; 144 goto out;
143 } 145 }
@@ -400,13 +402,23 @@ static int autofs4_revalidate(struct dentry *dentry, struct nameidata *nd)
400 struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb); 402 struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb);
401 int oz_mode = autofs4_oz_mode(sbi); 403 int oz_mode = autofs4_oz_mode(sbi);
402 int flags = nd ? nd->flags : 0; 404 int flags = nd ? nd->flags : 0;
403 int status = 0; 405 int status = 1;
404 406
405 /* Pending dentry */ 407 /* Pending dentry */
406 if (autofs4_ispending(dentry)) { 408 if (autofs4_ispending(dentry)) {
407 if (!oz_mode) 409 /* The daemon never causes a mount to trigger */
408 status = try_to_fill_dentry(dentry, flags); 410 if (oz_mode)
409 return !status; 411 return 1;
412
413 /*
414 * A zero status is success otherwise we have a
415 * negative error code.
416 */
417 status = try_to_fill_dentry(dentry, flags);
418 if (status == 0)
419 return 1;
420
421 return status;
410 } 422 }
411 423
412 /* Negative dentry.. invalidate if "old" */ 424 /* Negative dentry.. invalidate if "old" */
@@ -421,9 +433,19 @@ static int autofs4_revalidate(struct dentry *dentry, struct nameidata *nd)
421 DPRINTK("dentry=%p %.*s, emptydir", 433 DPRINTK("dentry=%p %.*s, emptydir",
422 dentry, dentry->d_name.len, dentry->d_name.name); 434 dentry, dentry->d_name.len, dentry->d_name.name);
423 spin_unlock(&dcache_lock); 435 spin_unlock(&dcache_lock);
424 if (!oz_mode) 436 /* The daemon never causes a mount to trigger */
425 status = try_to_fill_dentry(dentry, flags); 437 if (oz_mode)
426 return !status; 438 return 1;
439
440 /*
441 * A zero status is success otherwise we have a
442 * negative error code.
443 */
444 status = try_to_fill_dentry(dentry, flags);
445 if (status == 0)
446 return 1;
447
448 return status;
427 } 449 }
428 spin_unlock(&dcache_lock); 450 spin_unlock(&dcache_lock);
429 451