diff options
-rw-r--r-- | fs/notify/mark.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/fs/notify/mark.c b/fs/notify/mark.c index e8c2f829ce65..b3f83ed6e8be 100644 --- a/fs/notify/mark.c +++ b/fs/notify/mark.c | |||
@@ -224,42 +224,6 @@ void fsnotify_destroy_mark(struct fsnotify_mark *mark, | |||
224 | fsnotify_free_mark(mark); | 224 | fsnotify_free_mark(mark); |
225 | } | 225 | } |
226 | 226 | ||
227 | void fsnotify_destroy_marks(struct fsnotify_mark_connector *conn, | ||
228 | spinlock_t *lock) | ||
229 | { | ||
230 | struct fsnotify_mark *mark; | ||
231 | |||
232 | if (!conn) | ||
233 | return; | ||
234 | |||
235 | while (1) { | ||
236 | /* | ||
237 | * We have to be careful since we can race with e.g. | ||
238 | * fsnotify_clear_marks_by_group() and once we drop 'lock', | ||
239 | * mark can get removed from the obj_list and destroyed. But | ||
240 | * we are holding mark reference so mark cannot be freed and | ||
241 | * calling fsnotify_destroy_mark() more than once is fine. | ||
242 | */ | ||
243 | spin_lock(lock); | ||
244 | if (hlist_empty(&conn->list)) { | ||
245 | spin_unlock(lock); | ||
246 | break; | ||
247 | } | ||
248 | mark = hlist_entry(conn->list.first, struct fsnotify_mark, | ||
249 | obj_list); | ||
250 | /* | ||
251 | * We don't update i_fsnotify_mask / mnt_fsnotify_mask here | ||
252 | * since inode / mount is going away anyway. So just remove | ||
253 | * mark from the list. | ||
254 | */ | ||
255 | hlist_del_init_rcu(&mark->obj_list); | ||
256 | fsnotify_get_mark(mark); | ||
257 | spin_unlock(lock); | ||
258 | fsnotify_destroy_mark(mark, mark->group); | ||
259 | fsnotify_put_mark(mark); | ||
260 | } | ||
261 | } | ||
262 | |||
263 | void fsnotify_connector_free(struct fsnotify_mark_connector **connp) | 227 | void fsnotify_connector_free(struct fsnotify_mark_connector **connp) |
264 | { | 228 | { |
265 | if (*connp) { | 229 | if (*connp) { |
@@ -580,6 +544,42 @@ void fsnotify_detach_group_marks(struct fsnotify_group *group) | |||
580 | } | 544 | } |
581 | } | 545 | } |
582 | 546 | ||
547 | void fsnotify_destroy_marks(struct fsnotify_mark_connector *conn, | ||
548 | spinlock_t *lock) | ||
549 | { | ||
550 | struct fsnotify_mark *mark; | ||
551 | |||
552 | if (!conn) | ||
553 | return; | ||
554 | |||
555 | while (1) { | ||
556 | /* | ||
557 | * We have to be careful since we can race with e.g. | ||
558 | * fsnotify_clear_marks_by_group() and once we drop 'lock', | ||
559 | * mark can get removed from the obj_list and destroyed. But | ||
560 | * we are holding mark reference so mark cannot be freed and | ||
561 | * calling fsnotify_destroy_mark() more than once is fine. | ||
562 | */ | ||
563 | spin_lock(lock); | ||
564 | if (hlist_empty(&conn->list)) { | ||
565 | spin_unlock(lock); | ||
566 | break; | ||
567 | } | ||
568 | mark = hlist_entry(conn->list.first, struct fsnotify_mark, | ||
569 | obj_list); | ||
570 | /* | ||
571 | * We don't update i_fsnotify_mask / mnt_fsnotify_mask here | ||
572 | * since inode / mount is going away anyway. So just remove | ||
573 | * mark from the list. | ||
574 | */ | ||
575 | hlist_del_init_rcu(&mark->obj_list); | ||
576 | fsnotify_get_mark(mark); | ||
577 | spin_unlock(lock); | ||
578 | fsnotify_destroy_mark(mark, mark->group); | ||
579 | fsnotify_put_mark(mark); | ||
580 | } | ||
581 | } | ||
582 | |||
583 | /* | 583 | /* |
584 | * Nothing fancy, just initialize lists and locks and counters. | 584 | * Nothing fancy, just initialize lists and locks and counters. |
585 | */ | 585 | */ |