diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-04-30 18:27:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 20:04:04 -0400 |
commit | ddf676c38b56a8641c8eb9fb856fa304018ff390 (patch) | |
tree | 1c4aed96cc3f07c2f740929811156e16126f04f6 /fs/eventpoll.c | |
parent | eea1d585917c538d90bc26fda5d8e53796feada2 (diff) |
epoll: lock ep->mtx in ep_free to silence lockdep
Technically we do not need to hold ep->mtx during ep_free since we are
certain there are no other users of ep at that point. However, lockdep
complains with a "suspicious rcu_dereference_check() usage!" message; so
lock the mutex before ep_remove to silence the warning.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Arve Hjønnevåg <arve@android.com>
Cc: Davide Libenzi <davidel@xmailserver.org>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: NeilBrown <neilb@suse.de>,
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/eventpoll.c')
-rw-r--r-- | fs/eventpoll.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index a3acf936c72a..5744a7f01875 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -745,11 +745,15 @@ static void ep_free(struct eventpoll *ep) | |||
745 | * point we are sure no poll callbacks will be lingering around, and also by | 745 | * point we are sure no poll callbacks will be lingering around, and also by |
746 | * holding "epmutex" we can be sure that no file cleanup code will hit | 746 | * holding "epmutex" we can be sure that no file cleanup code will hit |
747 | * us during this operation. So we can avoid the lock on "ep->lock". | 747 | * us during this operation. So we can avoid the lock on "ep->lock". |
748 | * We do not need to lock ep->mtx, either, we only do it to prevent | ||
749 | * a lockdep warning. | ||
748 | */ | 750 | */ |
751 | mutex_lock(&ep->mtx); | ||
749 | while ((rbp = rb_first(&ep->rbr)) != NULL) { | 752 | while ((rbp = rb_first(&ep->rbr)) != NULL) { |
750 | epi = rb_entry(rbp, struct epitem, rbn); | 753 | epi = rb_entry(rbp, struct epitem, rbn); |
751 | ep_remove(ep, epi); | 754 | ep_remove(ep, epi); |
752 | } | 755 | } |
756 | mutex_unlock(&ep->mtx); | ||
753 | 757 | ||
754 | mutex_unlock(&epmutex); | 758 | mutex_unlock(&epmutex); |
755 | mutex_destroy(&ep->mtx); | 759 | mutex_destroy(&ep->mtx); |