]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
epoll: fix spurious lockdep warnings
authorNelson Elhage <nelhage@nelhage.com>
Wed, 5 Oct 2011 00:43:41 +0000 (11:43 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 13 Oct 2011 06:49:50 +0000 (17:49 +1100)
commit101ab64f5091412c614d71e5281cbef4bea0a06d
tree5242e8918017d0995cf5a861ef872dbd0bf7cf77
parent8c8027ac1a41d3bf449176c3deff80a845d20ba0
epoll: fix spurious lockdep warnings

epoll can acquire recursively acquire ep->mtx on multiple "struct
eventpoll"s at once in the case where one epoll fd is monitoring another
epoll fd.  This is perfectly OK, since we're careful about the lock
ordering, but it causes spurious lockdep warnings.  Annotate the recursion
using mutex_lock_nested, and add a comment explaining the nesting rules
for good measure.

Recent versions of systemd are triggering this, and it can also be
demonstrated with the following trivial test program:

--------------------8<--------------------

int main(void) {
   int e1, e2;
   struct epoll_event evt = {
       .events = EPOLLIN
   };

   e1 = epoll_create1(0);
   e2 = epoll_create1(0);
   epoll_ctl(e1, EPOLL_CTL_ADD, e2, &evt);
   return 0;
}
--------------------8<--------------------

Reported-by: Paul Bolle <pebolle@tiscali.nl>
Tested-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Nelson Elhage <nelhage@nelhage.com>
Acked-by: Jason Baron <jbaron@redhat.com>
Cc: Dave Jones <davej@redhat.com>
Cc: Davide Libenzi <davidel@xmailserver.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/eventpoll.c