diff options
Diffstat (limited to 'fs/sysfs/dir.c')
-rw-r--r-- | fs/sysfs/dir.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 3e937da224d4..a4846979d4e8 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -154,7 +154,6 @@ struct sysfs_dirent *sysfs_get_active(struct sysfs_dirent *sd) | |||
154 | */ | 154 | */ |
155 | void sysfs_put_active(struct sysfs_dirent *sd) | 155 | void sysfs_put_active(struct sysfs_dirent *sd) |
156 | { | 156 | { |
157 | struct completion *cmpl; | ||
158 | int v; | 157 | int v; |
159 | 158 | ||
160 | if (unlikely(!sd)) | 159 | if (unlikely(!sd)) |
@@ -166,10 +165,9 @@ void sysfs_put_active(struct sysfs_dirent *sd) | |||
166 | return; | 165 | return; |
167 | 166 | ||
168 | /* atomic_dec_return() is a mb(), we'll always see the updated | 167 | /* atomic_dec_return() is a mb(), we'll always see the updated |
169 | * sd->s_sibling. | 168 | * sd->u.completion. |
170 | */ | 169 | */ |
171 | cmpl = (void *)sd->s_sibling; | 170 | complete(sd->u.completion); |
172 | complete(cmpl); | ||
173 | } | 171 | } |
174 | 172 | ||
175 | /** | 173 | /** |
@@ -183,16 +181,16 @@ static void sysfs_deactivate(struct sysfs_dirent *sd) | |||
183 | DECLARE_COMPLETION_ONSTACK(wait); | 181 | DECLARE_COMPLETION_ONSTACK(wait); |
184 | int v; | 182 | int v; |
185 | 183 | ||
186 | BUG_ON(sd->s_sibling || !(sd->s_flags & SYSFS_FLAG_REMOVED)); | 184 | BUG_ON(!(sd->s_flags & SYSFS_FLAG_REMOVED)); |
187 | 185 | ||
188 | if (!(sysfs_type(sd) & SYSFS_ACTIVE_REF)) | 186 | if (!(sysfs_type(sd) & SYSFS_ACTIVE_REF)) |
189 | return; | 187 | return; |
190 | 188 | ||
191 | sd->s_sibling = (void *)&wait; | 189 | sd->u.completion = (void *)&wait; |
192 | 190 | ||
193 | rwsem_acquire(&sd->dep_map, 0, 0, _RET_IP_); | 191 | rwsem_acquire(&sd->dep_map, 0, 0, _RET_IP_); |
194 | /* atomic_add_return() is a mb(), put_active() will always see | 192 | /* atomic_add_return() is a mb(), put_active() will always see |
195 | * the updated sd->s_sibling. | 193 | * the updated sd->u.completion. |
196 | */ | 194 | */ |
197 | v = atomic_add_return(SD_DEACTIVATED_BIAS, &sd->s_active); | 195 | v = atomic_add_return(SD_DEACTIVATED_BIAS, &sd->s_active); |
198 | 196 | ||
@@ -201,8 +199,6 @@ static void sysfs_deactivate(struct sysfs_dirent *sd) | |||
201 | wait_for_completion(&wait); | 199 | wait_for_completion(&wait); |
202 | } | 200 | } |
203 | 201 | ||
204 | sd->s_sibling = NULL; | ||
205 | |||
206 | lock_acquired(&sd->dep_map, _RET_IP_); | 202 | lock_acquired(&sd->dep_map, _RET_IP_); |
207 | rwsem_release(&sd->dep_map, 1, _RET_IP_); | 203 | rwsem_release(&sd->dep_map, 1, _RET_IP_); |
208 | } | 204 | } |
@@ -518,7 +514,7 @@ void sysfs_remove_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) | |||
518 | } | 514 | } |
519 | 515 | ||
520 | sd->s_flags |= SYSFS_FLAG_REMOVED; | 516 | sd->s_flags |= SYSFS_FLAG_REMOVED; |
521 | sd->s_sibling = acxt->removed; | 517 | sd->u.removed_list = acxt->removed; |
522 | acxt->removed = sd; | 518 | acxt->removed = sd; |
523 | } | 519 | } |
524 | 520 | ||
@@ -542,8 +538,7 @@ void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt) | |||
542 | while (acxt->removed) { | 538 | while (acxt->removed) { |
543 | struct sysfs_dirent *sd = acxt->removed; | 539 | struct sysfs_dirent *sd = acxt->removed; |
544 | 540 | ||
545 | acxt->removed = sd->s_sibling; | 541 | acxt->removed = sd->u.removed_list; |
546 | sd->s_sibling = NULL; | ||
547 | 542 | ||
548 | sysfs_deactivate(sd); | 543 | sysfs_deactivate(sd); |
549 | unmap_bin_file(sd); | 544 | unmap_bin_file(sd); |