diff options
author | Jan Kara <jack@suse.cz> | 2014-04-03 17:46:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-03 19:20:51 -0400 |
commit | 9573f79355ff3711c98227d14a9b7f4cb3222b97 (patch) | |
tree | b1ad8d66757b538cf67a570332ae263e2510fc50 /fs | |
parent | f083441ba86acb9e2ef9c1d1747725e488c8b1ff (diff) |
fanotify: convert access_mutex to spinlock
access_mutex is used only to guard operations on access_list. There's
no need for sleeping within this lock so just make a spinlock out of it.
Signed-off-by: Jan Kara <jack@suse.cz>
Cc: Eric Paris <eparis@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/notify/fanotify/fanotify_user.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index 8f5e85269110..2a57278afb80 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c | |||
@@ -134,7 +134,7 @@ static struct fanotify_perm_event_info *dequeue_event( | |||
134 | { | 134 | { |
135 | struct fanotify_perm_event_info *event, *return_e = NULL; | 135 | struct fanotify_perm_event_info *event, *return_e = NULL; |
136 | 136 | ||
137 | mutex_lock(&group->fanotify_data.access_mutex); | 137 | spin_lock(&group->fanotify_data.access_lock); |
138 | list_for_each_entry(event, &group->fanotify_data.access_list, | 138 | list_for_each_entry(event, &group->fanotify_data.access_list, |
139 | fae.fse.list) { | 139 | fae.fse.list) { |
140 | if (event->fd != fd) | 140 | if (event->fd != fd) |
@@ -144,7 +144,7 @@ static struct fanotify_perm_event_info *dequeue_event( | |||
144 | return_e = event; | 144 | return_e = event; |
145 | break; | 145 | break; |
146 | } | 146 | } |
147 | mutex_unlock(&group->fanotify_data.access_mutex); | 147 | spin_unlock(&group->fanotify_data.access_lock); |
148 | 148 | ||
149 | pr_debug("%s: found return_re=%p\n", __func__, return_e); | 149 | pr_debug("%s: found return_re=%p\n", __func__, return_e); |
150 | 150 | ||
@@ -213,10 +213,10 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group, | |||
213 | 213 | ||
214 | pevent = FANOTIFY_PE(event); | 214 | pevent = FANOTIFY_PE(event); |
215 | pevent->fd = fd; | 215 | pevent->fd = fd; |
216 | mutex_lock(&group->fanotify_data.access_mutex); | 216 | spin_lock(&group->fanotify_data.access_lock); |
217 | list_add_tail(&pevent->fae.fse.list, | 217 | list_add_tail(&pevent->fae.fse.list, |
218 | &group->fanotify_data.access_list); | 218 | &group->fanotify_data.access_list); |
219 | mutex_unlock(&group->fanotify_data.access_mutex); | 219 | spin_unlock(&group->fanotify_data.access_lock); |
220 | } | 220 | } |
221 | #endif | 221 | #endif |
222 | 222 | ||
@@ -346,7 +346,7 @@ static int fanotify_release(struct inode *ignored, struct file *file) | |||
346 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS | 346 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS |
347 | struct fanotify_perm_event_info *event, *next; | 347 | struct fanotify_perm_event_info *event, *next; |
348 | 348 | ||
349 | mutex_lock(&group->fanotify_data.access_mutex); | 349 | spin_lock(&group->fanotify_data.access_lock); |
350 | 350 | ||
351 | atomic_inc(&group->fanotify_data.bypass_perm); | 351 | atomic_inc(&group->fanotify_data.bypass_perm); |
352 | 352 | ||
@@ -358,7 +358,7 @@ static int fanotify_release(struct inode *ignored, struct file *file) | |||
358 | list_del_init(&event->fae.fse.list); | 358 | list_del_init(&event->fae.fse.list); |
359 | event->response = FAN_ALLOW; | 359 | event->response = FAN_ALLOW; |
360 | } | 360 | } |
361 | mutex_unlock(&group->fanotify_data.access_mutex); | 361 | spin_unlock(&group->fanotify_data.access_lock); |
362 | 362 | ||
363 | wake_up(&group->fanotify_data.access_waitq); | 363 | wake_up(&group->fanotify_data.access_waitq); |
364 | #endif | 364 | #endif |
@@ -700,7 +700,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) | |||
700 | 700 | ||
701 | group->fanotify_data.f_flags = event_f_flags; | 701 | group->fanotify_data.f_flags = event_f_flags; |
702 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS | 702 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS |
703 | mutex_init(&group->fanotify_data.access_mutex); | 703 | spin_lock_init(&group->fanotify_data.access_lock); |
704 | init_waitqueue_head(&group->fanotify_data.access_waitq); | 704 | init_waitqueue_head(&group->fanotify_data.access_waitq); |
705 | INIT_LIST_HEAD(&group->fanotify_data.access_list); | 705 | INIT_LIST_HEAD(&group->fanotify_data.access_list); |
706 | atomic_set(&group->fanotify_data.bypass_perm, 0); | 706 | atomic_set(&group->fanotify_data.bypass_perm, 0); |