]> git.karo-electronics.de Git - karo-tx-linux.git/commit
fsnotify: use reference counting for groups
authorLino Sanfilippo <LinoSanfilippo@gmx.de>
Tue, 14 Jun 2011 15:29:47 +0000 (17:29 +0200)
committerEric Paris <eparis@redhat.com>
Mon, 26 Mar 2012 15:20:30 +0000 (11:20 -0400)
commit0f948ec4aff7eb629b08e7dd3d9761be17a1ae9e
tree7512f1f8521ed69a45bbe86a32223c5b48aacf30
parent159fbe33a7c7c9ecee7a131c5b1d28319b2108c0
fsnotify: use reference counting for groups

Get a group ref for each mark that is added to the groups list and release that
ref when the mark is freed in fsnotify_put_mark().
We also use get a group reference for duplicated marks and for private event
data.
Now we dont free a group any more when the number of marks becomes 0 but when
the groups ref count does. Since this will only happen when all marks are removed
from a groups mark list, we dont have to set the groups number of marks to 1 at
group creation.

Beside clearing all marks in fsnotify_destroy_group() we do also flush the
groups event queue. This is since events may hold references to groups (due to
private event data) and we have to put those references first before we get a
chance to put the final ref, which will result in a call to
fsnotify_final_destroy_group().

Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de>
Signed-off-by: Eric Paris <eparis@redhat.com>
fs/notify/group.c
fs/notify/inotify/inotify_fsnotify.c
fs/notify/inotify/inotify_user.c
fs/notify/mark.c