aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4/root.c
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2008-07-24 00:30:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-24 13:47:31 -0400
commitc432c2586a0811c7d0030d78f0993568bc889a6f (patch)
treeb5d711345120af6cc6ae67836d0773a5857e3e8c /fs/autofs4/root.c
parentef581a742874ebc4c28d24b374c78b762144ebdc (diff)
autofs4: don't release directory mutex if called in oz_mode
Since we now delay hashing of dentrys until the ->mkdir() call, droping and re-taking the directory mutex within the ->lookup() function when we are being called by user space is not needed. This can lead to a race when other processes are attempting to access the same directory during mount point directory creation. In this case we need to hang onto the mutex to ensure we don't get user processes trying to create a mount request for a newly created dentry after the mount point entry has already been created. This ensures that when we need to check a dentry passed to autofs4_wait(), if it is hashed, it is always the mount point dentry and not a new dentry created by another lookup during directory creation. Signed-off-by: Ian Kent <raven@themaw.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/autofs4/root.c')
-rw-r--r--fs/autofs4/root.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 324290c68275..1e901e5ea013 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -686,12 +686,11 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
686 spin_lock(&dentry->d_lock); 686 spin_lock(&dentry->d_lock);
687 dentry->d_flags |= DCACHE_AUTOFS_PENDING; 687 dentry->d_flags |= DCACHE_AUTOFS_PENDING;
688 spin_unlock(&dentry->d_lock); 688 spin_unlock(&dentry->d_lock);
689 } 689 if (dentry->d_op && dentry->d_op->d_revalidate) {
690 690 mutex_unlock(&dir->i_mutex);
691 if (dentry->d_op && dentry->d_op->d_revalidate) { 691 (dentry->d_op->d_revalidate)(dentry, nd);
692 mutex_unlock(&dir->i_mutex); 692 mutex_lock(&dir->i_mutex);
693 (dentry->d_op->d_revalidate)(dentry, nd); 693 }
694 mutex_lock(&dir->i_mutex);
695 } 694 }
696 695
697 /* 696 /*