fsnotify: Free fsnotify_mark_connector when there is no mark attached
authorJan Kara <jack@suse.cz>
Wed, 1 Feb 2017 08:21:58 +0000 (09:21 +0100)
committerJan Kara <jack@suse.cz>
Mon, 10 Apr 2017 15:37:35 +0000 (17:37 +0200)
commit08991e83b7286635167bab40927665a90fb00d81
treee82e62c0a92193ff3af83d3d1ea60f0430c5c118
parent04662cab59fc3e8421fd7a0539d304d51d2750a4
fsnotify: Free fsnotify_mark_connector when there is no mark attached

Currently we free fsnotify_mark_connector structure only when inode /
vfsmount is getting freed. This can however impose noticeable memory
overhead when marks get attached to inodes only temporarily. So free the
connector structure once the last mark is detached from the object.
Since notification infrastructure can be working with the connector
under the protection of fsnotify_mark_srcu, we have to be careful and
free the fsnotify_mark_connector only after SRCU period passes.

Reviewed-by: Miklos Szeredi <mszeredi@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/inode.c
fs/mount.h
fs/namespace.c
fs/notify/fsnotify.c
fs/notify/fsnotify.h
fs/notify/inode_mark.c
fs/notify/mark.c
fs/notify/vfsmount_mark.c
include/linux/fs.h
include/linux/fsnotify_backend.h
kernel/auditsc.c