diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2011-06-20 14:20:04 +1000 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2011-06-20 14:20:04 +1000 |
commit | b1b6347ddb8b331dc4dd3dd28892074767d71686 (patch) | |
tree | 39b74a3e02cc4b3216f5063be0d7586ea5b06ba7 /include | |
parent | 877ddcea7efad94311dbfa448e84ba69b15030ee (diff) | |
parent | ef9bf3b7144bee6ce1da5616015cabc8771206af (diff) |
Merge remote-tracking branch 'fsnotify/for-next'
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/fanotify.h | 5 | ||||
-rw-r--r-- | include/linux/fsnotify_backend.h | 14 |
2 files changed, 16 insertions, 3 deletions
diff --git a/include/linux/fanotify.h b/include/linux/fanotify.h index 6c6133f76e16..b5fac2ba4a07 100644 --- a/include/linux/fanotify.h +++ b/include/linux/fanotify.h @@ -36,9 +36,12 @@ #define FAN_UNLIMITED_QUEUE 0x00000010 #define FAN_UNLIMITED_MARKS 0x00000020 +/* Attempt read-only open if read-write failed. */ +#define FAN_READONLY_FALLBACK 0x00000040 + #define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | \ FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE |\ - FAN_UNLIMITED_MARKS) + FAN_UNLIMITED_MARKS | FAN_READONLY_FALLBACK) /* flags used for fanotify_modify_mark() */ #define FAN_MARK_ADD 0x00000001 diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index 69ad89b50489..8aa4731c9f6f 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h @@ -125,6 +125,7 @@ struct fsnotify_group { const struct fsnotify_ops *ops; /* how this group handles things */ + struct mutex mutex; /* needed to send notification to userspace */ struct mutex notification_mutex; /* protect the notification_list */ struct list_head notification_list; /* list of event_holder this group needs to send to userspace */ @@ -168,6 +169,7 @@ struct fsnotify_group { wait_queue_head_t access_waitq; atomic_t bypass_perm; #endif /* CONFIG_FANOTIFY_ACCESS_PERMISSIONS */ + bool readonly_fallback; int f_flags; unsigned int max_marks; struct user_struct *user; @@ -415,8 +417,6 @@ extern void fsnotify_clear_inode_marks_by_group(struct fsnotify_group *group); extern void fsnotify_clear_marks_by_group_flags(struct fsnotify_group *group, unsigned int flags); /* run all the marks in a group, and flag them to be freed */ extern void fsnotify_clear_marks_by_group(struct fsnotify_group *group); -extern void fsnotify_get_mark(struct fsnotify_mark *mark); -extern void fsnotify_put_mark(struct fsnotify_mark *mark); extern void fsnotify_unmount_inodes(struct list_head *list); /* put here because inotify does some weird stuff when destroying watches */ @@ -430,6 +430,16 @@ extern struct fsnotify_event *fsnotify_clone_event(struct fsnotify_event *old_ev extern int fsnotify_replace_event(struct fsnotify_event_holder *old_holder, struct fsnotify_event *new_event); +static inline void fsnotify_get_mark(struct fsnotify_mark *mark) +{ + atomic_inc(&mark->refcnt); +} + +static inline void fsnotify_put_mark(struct fsnotify_mark *mark) +{ + if (atomic_dec_and_test(&mark->refcnt)) + mark->free_mark(mark); +} #else static inline int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, |