]> bbs.cooldavid.org Git - net-next-2.6.git/commit
fanotify: flush outstanding perm requests on group destroy
authorEric Paris <eparis@redhat.com>
Wed, 18 Aug 2010 16:25:50 +0000 (12:25 -0400)
committerEric Paris <eparis@redhat.com>
Mon, 23 Aug 2010 00:28:16 +0000 (20:28 -0400)
commit2eebf582c9b3106abb9c33f4fc0a347fb9391037
tree0fab23d7e456713815890fc01a148132b9b857f8
parent84e1ab4d875922c034db7f4f814ac445a20a14bd
fanotify: flush outstanding perm requests on group destroy

When an fanotify listener is closing it may cause a deadlock between the
listener and the original task doing an fs operation.  If the original task
is waiting for a permissions response it will be holding the srcu lock.  The
listener cannot clean up and exit until after that srcu lock is syncronized.
Thus deadlock.  The fix introduced here is to stop accepting new permissions
events when a listener is shutting down and to grant permission for all
outstanding events.  Thus the original task will eventually release the srcu
lock and the listener can complete shutdown.

Reported-by: Andreas Gruenbacher <agruen@suse.de>
Cc: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Eric Paris <eparis@redhat.com>
fs/notify/fanotify/fanotify_user.c
include/linux/fanotify.h
include/linux/fsnotify_backend.h