2011-02-24 12:40:43

by Lino Sanfilippo

[permalink] [raw]
Subject: [PATCH] inotify: dont skip removing mark from idr when creation of ignore event failed

In inotify_ignored_and_remove_idr() dont skip removing a mark from the idr if
allocating an "ignored event" failed.

Signed-off-by: Lino Sanfilippo <[email protected]>
---
The patch applies against commit ef9bf3b7144bee6ce1da5616015cabc8771206af of
branch 'origin/for-next' from git.infradead.org/users/eparis/notify.git

fs/notify/inotify/inotify_user.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 4cd5d5d..3cda8a4 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -522,17 +522,17 @@ void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark,
struct fsnotify_event_private_data *fsn_event_priv;
int ret;

+ i_mark = container_of(fsn_mark, struct inotify_inode_mark, fsn_mark);
+
ignored_event = fsnotify_create_event(NULL, FS_IN_IGNORED, NULL,
FSNOTIFY_EVENT_NONE, NULL, 0,
GFP_NOFS);
if (!ignored_event)
- return;
-
- i_mark = container_of(fsn_mark, struct inotify_inode_mark, fsn_mark);
+ goto skip_send_ignore;

event_priv = kmem_cache_alloc(event_priv_cachep, GFP_NOFS);
if (unlikely(!event_priv))
- goto skip_send_ignore;
+ goto skip_send_ignore2;

fsn_event_priv = &event_priv->fsnotify_event_priv_data;

@@ -548,11 +548,12 @@ void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark,
inotify_free_event_priv(fsn_event_priv);
}

-skip_send_ignore:
+skip_send_ignore2:

/* matches the reference taken when the event was created */
fsnotify_put_event(ignored_event);

+skip_send_ignore:
/* remove this mark from the idr */
inotify_remove_from_idr(group, i_mark);

--
1.7.1