fsnotify: Make fsnotify_mark_connector hold inode reference

Currently inode reference is held by fsnotify marks. Change the rules so
that inode reference is held by fsnotify_mark_connector structure
whenever the list is non-empty. This simplifies the code and is more
logical.

Reviewed-by: Miklos Szeredi <mszeredi@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
Jan Kara 2017-03-14 14:48:00 +01:00
parent 86ffe245c4
commit e911d8af87
4 changed files with 18 additions and 45 deletions

View file

@ -196,8 +196,9 @@ struct fsnotify_group {
/*
* Inode / vfsmount point to this structure which tracks all marks attached to
* the inode / vfsmount. The structure is freed only when inode / vfsmount gets
* freed.
* the inode / vfsmount. The reference to inode / vfsmount is held by this
* structure whenever the list is non-empty. The structure is freed only when
* inode / vfsmount gets freed.
*/
struct fsnotify_mark_connector {
#define FSNOTIFY_OBJ_TYPE_INODE 0x01
@ -245,10 +246,9 @@ struct fsnotify_mark {
struct fsnotify_mark_connector *connector;
/* Events types to ignore [mark->lock, group->mark_mutex] */
__u32 ignored_mask;
#define FSNOTIFY_MARK_FLAG_OBJECT_PINNED 0x04
#define FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY 0x08
#define FSNOTIFY_MARK_FLAG_ALIVE 0x10
#define FSNOTIFY_MARK_FLAG_ATTACHED 0x20
#define FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY 0x01
#define FSNOTIFY_MARK_FLAG_ALIVE 0x02
#define FSNOTIFY_MARK_FLAG_ATTACHED 0x04
unsigned int flags; /* flags [mark->lock] */
void (*free_mark)(struct fsnotify_mark *mark); /* called on final put+free */
};