linux/fs/notify
Jan Kara 9dd813c15b fsnotify: Move mark list head from object into dedicated structure
Currently notification marks are attached to object (inode or vfsmnt) by
a hlist_head in the object. The list is also protected by a spinlock in
the object. So while there is any mark attached to the list of marks,
the object must be pinned in memory (and thus e.g. last iput() deleting
inode cannot happen). Also for list iteration in fsnotify() to work, we
must hold fsnotify_mark_srcu lock so that mark itself and
mark->obj_list.next cannot get freed. Thus we are required to wait for
response to fanotify events from userspace process with
fsnotify_mark_srcu lock held. That causes issues when userspace process
is buggy and does not reply to some event - basically the whole
notification subsystem gets eventually stuck.

So to be able to drop fsnotify_mark_srcu lock while waiting for
response, we have to pin the mark in memory and make sure it stays in
the object list (as removing the mark waiting for response could lead to
lost notification events for groups later in the list). However we don't
want inode reclaim to block on such mark as that would lead to system
just locking up elsewhere.

This commit is the first in the series that paves way towards solving
these conflicting lifetime needs. Instead of anchoring the list of marks
directly in the object, we anchor it in a dedicated structure
(fsnotify_mark_connector) and just point to that structure from the
object. The following commits will also add spinlock protecting the list
and object pointer to the structure.

Reviewed-by: Miklos Szeredi <mszeredi@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
2017-04-10 17:37:34 +02:00
..
dnotify fsnotify: constify 'data' passed to ->handle_event() 2016-12-05 18:58:31 -05:00
fanotify fanotify: Move recalculation of inode / vfsmount mask under mark_mutex 2017-04-03 16:56:40 +02:00
inotify inotify: Remove inode pointers from debug messages 2017-04-03 16:56:34 +02:00
fdinfo.c fsnotify: Remove unnecessary tests when showing fdinfo 2017-04-03 16:56:18 +02:00
fdinfo.h fs: Convert show_fdinfo functions to void 2014-11-05 14:13:23 -05:00
fsnotify.c fsnotify: Move mark list head from object into dedicated structure 2017-04-10 17:37:34 +02:00
fsnotify.h fsnotify: Move mark list head from object into dedicated structure 2017-04-10 17:37:34 +02:00
group.c fsnotify: convert notification_mutex to a spinlock 2016-10-07 18:46:26 -07:00
inode_mark.c fsnotify: Move mark list head from object into dedicated structure 2017-04-10 17:37:34 +02:00
Kconfig rcu: Make SRCU optional by using CONFIG_SRCU 2015-01-06 11:04:29 -08:00
Makefile
mark.c fsnotify: Move mark list head from object into dedicated structure 2017-04-10 17:37:34 +02:00
notification.c fsnotify: clean up spinlock assertions 2016-10-07 18:46:26 -07:00
vfsmount_mark.c fsnotify: Move mark list head from object into dedicated structure 2017-04-10 17:37:34 +02:00