aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4/root.c
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2011-03-24 13:51:31 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-03-24 14:54:35 -0400
commite7854723d0f3626f260c880d8db8e5136f29db19 (patch)
tree3fe4f138922f51d8214ccc6bd2fb9ed4dfa1f234 /fs/autofs4/root.c
parent83fb96bfc792e5ca693e53f7fd878d51b8493da8 (diff)
autofs4 - remove autofs4_lock
The autofs4_lock introduced by the rcu-walk changes has unnecessarily broad scope. The locking is better handled by the per-autofs super block lookup_lock. Signed-off-by: Ian Kent <raven@themaw.net> Acked-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/autofs4/root.c')
-rw-r--r--fs/autofs4/root.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index ebbfa0ce6d7b..96804a17bbd0 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -23,8 +23,6 @@
23 23
24#include "autofs_i.h" 24#include "autofs_i.h"
25 25
26DEFINE_SPINLOCK(autofs4_lock);
27
28static int autofs4_dir_symlink(struct inode *,struct dentry *,const char *); 26static int autofs4_dir_symlink(struct inode *,struct dentry *,const char *);
29static int autofs4_dir_unlink(struct inode *,struct dentry *); 27static int autofs4_dir_unlink(struct inode *,struct dentry *);
30static int autofs4_dir_rmdir(struct inode *,struct dentry *); 28static int autofs4_dir_rmdir(struct inode *,struct dentry *);
@@ -125,15 +123,15 @@ static int autofs4_dir_open(struct inode *inode, struct file *file)
125 * autofs file system so just let the libfs routines handle 123 * autofs file system so just let the libfs routines handle
126 * it. 124 * it.
127 */ 125 */
128 spin_lock(&autofs4_lock); 126 spin_lock(&sbi->lookup_lock);
129 spin_lock(&dentry->d_lock); 127 spin_lock(&dentry->d_lock);
130 if (!d_mountpoint(dentry) && list_empty(&dentry->d_subdirs)) { 128 if (!d_mountpoint(dentry) && list_empty(&dentry->d_subdirs)) {
131 spin_unlock(&dentry->d_lock); 129 spin_unlock(&dentry->d_lock);
132 spin_unlock(&autofs4_lock); 130 spin_unlock(&sbi->lookup_lock);
133 return -ENOENT; 131 return -ENOENT;
134 } 132 }
135 spin_unlock(&dentry->d_lock); 133 spin_unlock(&dentry->d_lock);
136 spin_unlock(&autofs4_lock); 134 spin_unlock(&sbi->lookup_lock);
137 135
138out: 136out:
139 return dcache_dir_open(inode, file); 137 return dcache_dir_open(inode, file);
@@ -171,7 +169,6 @@ static struct dentry *autofs4_lookup_active(struct dentry *dentry)
171 const unsigned char *str = name->name; 169 const unsigned char *str = name->name;
172 struct list_head *p, *head; 170 struct list_head *p, *head;
173 171
174 spin_lock(&autofs4_lock);
175 spin_lock(&sbi->lookup_lock); 172 spin_lock(&sbi->lookup_lock);
176 head = &sbi->active_list; 173 head = &sbi->active_list;
177 list_for_each(p, head) { 174 list_for_each(p, head) {
@@ -204,14 +201,12 @@ static struct dentry *autofs4_lookup_active(struct dentry *dentry)
204 dget_dlock(active); 201 dget_dlock(active);
205 spin_unlock(&active->d_lock); 202 spin_unlock(&active->d_lock);
206 spin_unlock(&sbi->lookup_lock); 203 spin_unlock(&sbi->lookup_lock);
207 spin_unlock(&autofs4_lock);
208 return active; 204 return active;
209 } 205 }
210next: 206next:
211 spin_unlock(&active->d_lock); 207 spin_unlock(&active->d_lock);
212 } 208 }
213 spin_unlock(&sbi->lookup_lock); 209 spin_unlock(&sbi->lookup_lock);
214 spin_unlock(&autofs4_lock);
215 210
216 return NULL; 211 return NULL;
217} 212}
@@ -226,7 +221,6 @@ static struct dentry *autofs4_lookup_expiring(struct dentry *dentry)
226 const unsigned char *str = name->name; 221 const unsigned char *str = name->name;
227 struct list_head *p, *head; 222 struct list_head *p, *head;
228 223
229 spin_lock(&autofs4_lock);
230 spin_lock(&sbi->lookup_lock); 224 spin_lock(&sbi->lookup_lock);
231 head = &sbi->expiring_list; 225 head = &sbi->expiring_list;
232 list_for_each(p, head) { 226 list_for_each(p, head) {
@@ -259,14 +253,12 @@ static struct dentry *autofs4_lookup_expiring(struct dentry *dentry)
259 dget_dlock(expiring); 253 dget_dlock(expiring);
260 spin_unlock(&expiring->d_lock); 254 spin_unlock(&expiring->d_lock);
261 spin_unlock(&sbi->lookup_lock); 255 spin_unlock(&sbi->lookup_lock);
262 spin_unlock(&autofs4_lock);
263 return expiring; 256 return expiring;
264 } 257 }
265next: 258next:
266 spin_unlock(&expiring->d_lock); 259 spin_unlock(&expiring->d_lock);
267 } 260 }
268 spin_unlock(&sbi->lookup_lock); 261 spin_unlock(&sbi->lookup_lock);
269 spin_unlock(&autofs4_lock);
270 262
271 return NULL; 263 return NULL;
272} 264}
@@ -603,12 +595,12 @@ static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry)
603 595
604 dir->i_mtime = CURRENT_TIME; 596 dir->i_mtime = CURRENT_TIME;
605 597
606 spin_lock(&autofs4_lock); 598 spin_lock(&sbi->lookup_lock);
607 autofs4_add_expiring(dentry); 599 __autofs4_add_expiring(dentry);
608 spin_lock(&dentry->d_lock); 600 spin_lock(&dentry->d_lock);
609 __d_drop(dentry); 601 __d_drop(dentry);
610 spin_unlock(&dentry->d_lock); 602 spin_unlock(&dentry->d_lock);
611 spin_unlock(&autofs4_lock); 603 spin_unlock(&sbi->lookup_lock);
612 604
613 return 0; 605 return 0;
614} 606}
@@ -677,20 +669,17 @@ static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry)
677 if (!autofs4_oz_mode(sbi)) 669 if (!autofs4_oz_mode(sbi))
678 return -EACCES; 670 return -EACCES;
679 671
680 spin_lock(&autofs4_lock);
681 spin_lock(&sbi->lookup_lock); 672 spin_lock(&sbi->lookup_lock);
682 spin_lock(&dentry->d_lock); 673 spin_lock(&dentry->d_lock);
683 if (!list_empty(&dentry->d_subdirs)) { 674 if (!list_empty(&dentry->d_subdirs)) {
684 spin_unlock(&dentry->d_lock); 675 spin_unlock(&dentry->d_lock);
685 spin_unlock(&sbi->lookup_lock); 676 spin_unlock(&sbi->lookup_lock);
686 spin_unlock(&autofs4_lock);
687 return -ENOTEMPTY; 677 return -ENOTEMPTY;
688 } 678 }
689 __autofs4_add_expiring(dentry); 679 __autofs4_add_expiring(dentry);
690 spin_unlock(&sbi->lookup_lock);
691 __d_drop(dentry); 680 __d_drop(dentry);
692 spin_unlock(&dentry->d_lock); 681 spin_unlock(&dentry->d_lock);
693 spin_unlock(&autofs4_lock); 682 spin_unlock(&sbi->lookup_lock);
694 683
695 if (sbi->version < 5) 684 if (sbi->version < 5)
696 autofs_clear_leaf_automount_flags(dentry); 685 autofs_clear_leaf_automount_flags(dentry);