aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/inotify_user.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/fs/inotify_user.c b/fs/inotify_user.c
index 5e009331c01f..c509a817068f 100644
--- a/fs/inotify_user.c
+++ b/fs/inotify_user.c
@@ -248,6 +248,19 @@ inotify_dev_get_event(struct inotify_device *dev)
248} 248}
249 249
250/* 250/*
251 * inotify_dev_get_last_event - return the last event in the given dev's queue
252 *
253 * Caller must hold dev->ev_mutex.
254 */
255static inline struct inotify_kernel_event *
256inotify_dev_get_last_event(struct inotify_device *dev)
257{
258 if (list_empty(&dev->events))
259 return NULL;
260 return list_entry(dev->events.prev, struct inotify_kernel_event, list);
261}
262
263/*
251 * inotify_dev_queue_event - event handler registered with core inotify, adds 264 * inotify_dev_queue_event - event handler registered with core inotify, adds
252 * a new event to the given device 265 * a new event to the given device
253 * 266 *
@@ -273,7 +286,7 @@ static void inotify_dev_queue_event(struct inotify_watch *w, u32 wd, u32 mask,
273 put_inotify_watch(w); /* final put */ 286 put_inotify_watch(w); /* final put */
274 287
275 /* coalescing: drop this event if it is a dupe of the previous */ 288 /* coalescing: drop this event if it is a dupe of the previous */
276 last = inotify_dev_get_event(dev); 289 last = inotify_dev_get_last_event(dev);
277 if (last && last->event.mask == mask && last->event.wd == wd && 290 if (last && last->event.mask == mask && last->event.wd == wd &&
278 last->event.cookie == cookie) { 291 last->event.cookie == cookie) {
279 const char *lastname = last->name; 292 const char *lastname = last->name;