Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 155900
b: refs/heads/master
c: f44aebc
h: refs/heads/master
v: v3
  • Loading branch information
Eric Paris committed Jul 21, 2009
1 parent 0a3fce7 commit eb68648
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c05594b62125c528d93af3a78229793aae36df7f
refs/heads/master: f44aebcc566d1d6275f7191867b9633dc11de2ee
4 changes: 3 additions & 1 deletion trunk/fs/notify/fsnotify.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, const
if (!group->ops->should_send_event(group, to_tell, mask))
continue;
if (!event) {
event = fsnotify_create_event(to_tell, mask, data, data_is, file_name, cookie);
event = fsnotify_create_event(to_tell, mask, data,
data_is, file_name, cookie,
GFP_KERNEL);
/* shit, we OOM'd and now we can't tell, maybe
* someday someone else will want to do something
* here */
Expand Down
18 changes: 12 additions & 6 deletions trunk/fs/notify/inotify/inotify_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ int inotify_max_user_watches __read_mostly;

static struct kmem_cache *inotify_inode_mark_cachep __read_mostly;
struct kmem_cache *event_priv_cachep __read_mostly;
static struct fsnotify_event *inotify_ignored_event;

/*
* When inotify registers a new group it increments this and uses that
Expand Down Expand Up @@ -384,12 +383,19 @@ void inotify_ignored_and_remove_idr(struct fsnotify_mark_entry *entry,
struct fsnotify_group *group)
{
struct inotify_inode_mark_entry *ientry;
struct fsnotify_event *ignored_event;
struct inotify_event_private_data *event_priv;
struct fsnotify_event_private_data *fsn_event_priv;

ignored_event = fsnotify_create_event(NULL, FS_IN_IGNORED, NULL,
FSNOTIFY_EVENT_NONE, NULL, 0,
GFP_NOFS);
if (!ignored_event)
return;

ientry = container_of(entry, struct inotify_inode_mark_entry, fsn_entry);

event_priv = kmem_cache_alloc(event_priv_cachep, GFP_KERNEL);
event_priv = kmem_cache_alloc(event_priv_cachep, GFP_NOFS);
if (unlikely(!event_priv))
goto skip_send_ignore;

Expand All @@ -398,14 +404,17 @@ void inotify_ignored_and_remove_idr(struct fsnotify_mark_entry *entry,
fsn_event_priv->group = group;
event_priv->wd = ientry->wd;

fsnotify_add_notify_event(group, inotify_ignored_event, fsn_event_priv);
fsnotify_add_notify_event(group, ignored_event, fsn_event_priv);

/* did the private data get added? */
if (list_empty(&fsn_event_priv->event_list))
inotify_free_event_priv(fsn_event_priv);

skip_send_ignore:

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

/* remove this entry from the idr */
inotify_remove_from_idr(group, ientry);

Expand Down Expand Up @@ -748,9 +757,6 @@ static int __init inotify_user_setup(void)

inotify_inode_mark_cachep = KMEM_CACHE(inotify_inode_mark_entry, SLAB_PANIC);
event_priv_cachep = KMEM_CACHE(inotify_event_private_data, SLAB_PANIC);
inotify_ignored_event = fsnotify_create_event(NULL, FS_IN_IGNORED, NULL, FSNOTIFY_EVENT_NONE, NULL, 0);
if (!inotify_ignored_event)
panic("unable to allocate the inotify ignored event\n");

inotify_max_queued_events = 16384;
inotify_max_user_instances = 128;
Expand Down
9 changes: 5 additions & 4 deletions trunk/fs/notify/notification.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ static bool event_compare(struct fsnotify_event *old, struct fsnotify_event *new
return true;
break;
case (FSNOTIFY_EVENT_NONE):
return true;
return false;
};
}
return false;
Expand Down Expand Up @@ -345,18 +345,19 @@ static void initialize_event(struct fsnotify_event *event)
* @name the filename, if available
*/
struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask, void *data,
int data_type, const char *name, u32 cookie)
int data_type, const char *name, u32 cookie,
gfp_t gfp)
{
struct fsnotify_event *event;

event = kmem_cache_alloc(fsnotify_event_cachep, GFP_KERNEL);
event = kmem_cache_alloc(fsnotify_event_cachep, gfp);
if (!event)
return NULL;

initialize_event(event);

if (name) {
event->file_name = kstrdup(name, GFP_KERNEL);
event->file_name = kstrdup(name, gfp);
if (!event->file_name) {
kmem_cache_free(fsnotify_event_cachep, event);
return NULL;
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/fsnotify_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ extern void fsnotify_unmount_inodes(struct list_head *list);
/* put here because inotify does some weird stuff when destroying watches */
extern struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask,
void *data, int data_is, const char *name,
u32 cookie);
u32 cookie, gfp_t gfp);

#else

Expand Down

0 comments on commit eb68648

Please sign in to comment.