aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4/expire.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/expire.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/expire.c')
-rw-r--r--fs/autofs4/expire.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c
index bc482e07b925..450f529a4eae 100644
--- a/fs/autofs4/expire.c
+++ b/fs/autofs4/expire.c
@@ -92,10 +92,11 @@ done:
92static struct dentry *get_next_positive_subdir(struct dentry *prev, 92static struct dentry *get_next_positive_subdir(struct dentry *prev,
93 struct dentry *root) 93 struct dentry *root)
94{ 94{
95 struct autofs_sb_info *sbi = autofs4_sbi(root->d_sb);
95 struct list_head *next; 96 struct list_head *next;
96 struct dentry *p, *q; 97 struct dentry *p, *q;
97 98
98 spin_lock(&autofs4_lock); 99 spin_lock(&sbi->lookup_lock);
99 100
100 if (prev == NULL) { 101 if (prev == NULL) {
101 spin_lock(&root->d_lock); 102 spin_lock(&root->d_lock);
@@ -112,7 +113,7 @@ again:
112start: 113start:
113 if (next == &root->d_subdirs) { 114 if (next == &root->d_subdirs) {
114 spin_unlock(&p->d_lock); 115 spin_unlock(&p->d_lock);
115 spin_unlock(&autofs4_lock); 116 spin_unlock(&sbi->lookup_lock);
116 dput(prev); 117 dput(prev);
117 return NULL; 118 return NULL;
118 } 119 }
@@ -129,7 +130,7 @@ start:
129 dget_dlock(q); 130 dget_dlock(q);
130 spin_unlock(&q->d_lock); 131 spin_unlock(&q->d_lock);
131 spin_unlock(&p->d_lock); 132 spin_unlock(&p->d_lock);
132 spin_unlock(&autofs4_lock); 133 spin_unlock(&sbi->lookup_lock);
133 134
134 dput(prev); 135 dput(prev);
135 136
@@ -142,13 +143,14 @@ start:
142static struct dentry *get_next_positive_dentry(struct dentry *prev, 143static struct dentry *get_next_positive_dentry(struct dentry *prev,
143 struct dentry *root) 144 struct dentry *root)
144{ 145{
146 struct autofs_sb_info *sbi = autofs4_sbi(root->d_sb);
145 struct list_head *next; 147 struct list_head *next;
146 struct dentry *p, *ret; 148 struct dentry *p, *ret;
147 149
148 if (prev == NULL) 150 if (prev == NULL)
149 return dget(root); 151 return dget(root);
150 152
151 spin_lock(&autofs4_lock); 153 spin_lock(&sbi->lookup_lock);
152relock: 154relock:
153 p = prev; 155 p = prev;
154 spin_lock(&p->d_lock); 156 spin_lock(&p->d_lock);
@@ -160,7 +162,7 @@ again:
160 162
161 if (p == root) { 163 if (p == root) {
162 spin_unlock(&p->d_lock); 164 spin_unlock(&p->d_lock);
163 spin_unlock(&autofs4_lock); 165 spin_unlock(&sbi->lookup_lock);
164 dput(prev); 166 dput(prev);
165 return NULL; 167 return NULL;
166 } 168 }
@@ -190,7 +192,7 @@ again:
190 dget_dlock(ret); 192 dget_dlock(ret);
191 spin_unlock(&ret->d_lock); 193 spin_unlock(&ret->d_lock);
192 spin_unlock(&p->d_lock); 194 spin_unlock(&p->d_lock);
193 spin_unlock(&autofs4_lock); 195 spin_unlock(&sbi->lookup_lock);
194 196
195 dput(prev); 197 dput(prev);
196 198
@@ -459,13 +461,13 @@ found:
459 ino->flags |= AUTOFS_INF_EXPIRING; 461 ino->flags |= AUTOFS_INF_EXPIRING;
460 init_completion(&ino->expire_complete); 462 init_completion(&ino->expire_complete);
461 spin_unlock(&sbi->fs_lock); 463 spin_unlock(&sbi->fs_lock);
462 spin_lock(&autofs4_lock); 464 spin_lock(&sbi->lookup_lock);
463 spin_lock(&expired->d_parent->d_lock); 465 spin_lock(&expired->d_parent->d_lock);
464 spin_lock_nested(&expired->d_lock, DENTRY_D_LOCK_NESTED); 466 spin_lock_nested(&expired->d_lock, DENTRY_D_LOCK_NESTED);
465 list_move(&expired->d_parent->d_subdirs, &expired->d_u.d_child); 467 list_move(&expired->d_parent->d_subdirs, &expired->d_u.d_child);
466 spin_unlock(&expired->d_lock); 468 spin_unlock(&expired->d_lock);
467 spin_unlock(&expired->d_parent->d_lock); 469 spin_unlock(&expired->d_parent->d_lock);
468 spin_unlock(&autofs4_lock); 470 spin_unlock(&sbi->lookup_lock);
469 return expired; 471 return expired;
470} 472}
471 473