diff options
-rw-r--r-- | fs/notify/fanotify/fanotify.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c index 8e574d6f6a80..5b0b6b485a9c 100644 --- a/fs/notify/fanotify/fanotify.c +++ b/fs/notify/fanotify/fanotify.c | |||
@@ -46,6 +46,16 @@ static int fanotify_merge(struct list_head *list, struct fsnotify_event *event) | |||
46 | if (test_event->mask == event->mask) | 46 | if (test_event->mask == event->mask) |
47 | goto out; | 47 | goto out; |
48 | 48 | ||
49 | /* | ||
50 | * if the refcnt == 1 this is the only queue | ||
51 | * for this event and so we can update the mask | ||
52 | * in place. | ||
53 | */ | ||
54 | if (atomic_read(&test_event->refcnt) == 1) { | ||
55 | test_event->mask |= event->mask; | ||
56 | goto out; | ||
57 | } | ||
58 | |||
49 | /* can't allocate memory, merge was no possible */ | 59 | /* can't allocate memory, merge was no possible */ |
50 | new_event = fsnotify_clone_event(test_event); | 60 | new_event = fsnotify_clone_event(test_event); |
51 | if (unlikely(!new_event)) { | 61 | if (unlikely(!new_event)) { |