diff options
author | Ian Kent <raven@themaw.net> | 2006-03-27 01:14:58 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-27 08:44:41 -0800 |
commit | 871f94344cea36b2ce91231f442f9f9298529712 (patch) | |
tree | 951865804407af1afcd7e84f1c152236302bb7f4 /fs/autofs4 | |
parent | 3370c74b2e147169d5bba6665e03d3281f5795ed (diff) | |
download | linux-871f94344cea36b2ce91231f442f9f9298529712.tar.gz linux-871f94344cea36b2ce91231f442f9f9298529712.tar.bz2 linux-871f94344cea36b2ce91231f442f9f9298529712.zip |
[PATCH] autofs4: follow_link missing functionality
This functionality is also need for operation of autofs v5 direct mounts.
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')
-rw-r--r-- | fs/autofs4/expire.c | 4 | ||||
-rw-r--r-- | fs/autofs4/root.c | 50 |
2 files changed, 44 insertions, 10 deletions
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index 08e33218a64a..b8ce02607d66 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c @@ -113,10 +113,6 @@ static int autofs4_direct_busy(struct vfsmount *mnt, DPRINTK("top %p %.*s", top, (int) top->d_name.len, top->d_name.name); - /* Not a mountpoint - give up */ - if (!d_mountpoint(top)) - return 1; - /* If it's busy update the expiry counters */ if (!may_umount_tree(mnt)) { struct autofs_info *ino = autofs4_dentry_ino(top); diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index 3f0048582248..c8fe43a475e2 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c @@ -57,6 +57,9 @@ struct inode_operations autofs4_indirect_root_inode_operations = { struct inode_operations autofs4_direct_root_inode_operations = { .lookup = autofs4_lookup, + .unlink = autofs4_dir_unlink, + .mkdir = autofs4_dir_mkdir, + .rmdir = autofs4_dir_rmdir, .follow_link = autofs4_follow_link, }; @@ -337,15 +340,50 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd) if (oz_mode || !lookup_type) goto done; - status = try_to_fill_dentry(dentry, 0); - if (status) - goto out_error; + /* + * If a request is pending wait for it. + * If it's a mount then it won't be expired till at least + * a liitle later and if it's an expire then we might need + * to mount it again. + */ + if (autofs4_ispending(dentry)) { + DPRINTK("waiting for active request %p name=%.*s", + dentry, dentry->d_name.len, dentry->d_name.name); - if (!autofs4_follow_mount(&nd->mnt, &nd->dentry)) { - status = -ENOENT; - goto out_error; + status = autofs4_wait(sbi, dentry, NFY_NONE); + + DPRINTK("request done status=%d", status); } + /* + * If the dentry contains directories then it is an + * autofs multi-mount with no root mount offset. So + * don't try to mount it again. + */ + spin_lock(&dcache_lock); + if (!d_mountpoint(dentry) && list_empty(&dentry->d_subdirs)) { + spin_unlock(&dcache_lock); + + status = try_to_fill_dentry(dentry, 0); + if (status) + goto out_error; + + /* + * The mount succeeded but if there is no root mount + * it must be an autofs multi-mount with no root offset + * so we don't need to follow the mount. + */ + if (d_mountpoint(dentry)) { + if (!autofs4_follow_mount(&nd->mnt, &nd->dentry)) { + status = -ENOENT; + goto out_error; + } + } + + goto done; + } + spin_unlock(&dcache_lock); + done: return NULL; |