aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2016-10-07 19:57:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-07 21:46:26 -0400
commited2726406c6a71f5da63719c0ba7d9e21dd9581c (patch)
tree8443da5c76097a56a635a4a5c834998498a99c01
parent0b1b86527df4b1f398266c23e926dd788925bb69 (diff)
fsnotify: clean up spinlock assertions
Use assert_spin_locked() macro instead of hand-made BUG_ON statements. Link: http://lkml.kernel.org/r/1474537439-18919-1-git-send-email-jack@suse.cz Signed-off-by: Jan Kara <jack@suse.cz> Suggested-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/notify/fanotify/fanotify_user.c3
-rw-r--r--fs/notify/notification.c9
2 files changed, 4 insertions, 8 deletions
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 189fab3ac4e6..7ebfca6a1427 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -54,8 +54,7 @@ struct kmem_cache *fanotify_perm_event_cachep __read_mostly;
54static struct fsnotify_event *get_one_event(struct fsnotify_group *group, 54static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
55 size_t count) 55 size_t count)
56{ 56{
57 BUG_ON(IS_ENABLED(CONFIG_SMP) && 57 assert_spin_locked(&group->notification_lock);
58 !spin_is_locked(&group->notification_lock));
59 58
60 pr_debug("%s: group=%p count=%zd\n", __func__, group, count); 59 pr_debug("%s: group=%p count=%zd\n", __func__, group, count);
61 60
diff --git a/fs/notify/notification.c b/fs/notify/notification.c
index 1a8010e7a2a0..66f85c651c52 100644
--- a/fs/notify/notification.c
+++ b/fs/notify/notification.c
@@ -63,8 +63,7 @@ EXPORT_SYMBOL_GPL(fsnotify_get_cookie);
63/* return true if the notify queue is empty, false otherwise */ 63/* return true if the notify queue is empty, false otherwise */
64bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group) 64bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group)
65{ 65{
66 BUG_ON(IS_ENABLED(CONFIG_SMP) && 66 assert_spin_locked(&group->notification_lock);
67 !spin_is_locked(&group->notification_lock));
68 return list_empty(&group->notification_list) ? true : false; 67 return list_empty(&group->notification_list) ? true : false;
69} 68}
70 69
@@ -149,8 +148,7 @@ struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group *group)
149{ 148{
150 struct fsnotify_event *event; 149 struct fsnotify_event *event;
151 150
152 BUG_ON(IS_ENABLED(CONFIG_SMP) && 151 assert_spin_locked(&group->notification_lock);
153 !spin_is_locked(&group->notification_lock));
154 152
155 pr_debug("%s: group=%p\n", __func__, group); 153 pr_debug("%s: group=%p\n", __func__, group);
156 154
@@ -172,8 +170,7 @@ struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group *group)
172 */ 170 */
173struct fsnotify_event *fsnotify_peek_first_event(struct fsnotify_group *group) 171struct fsnotify_event *fsnotify_peek_first_event(struct fsnotify_group *group)
174{ 172{
175 BUG_ON(IS_ENABLED(CONFIG_SMP) && 173 assert_spin_locked(&group->notification_lock);
176 !spin_is_locked(&group->notification_lock));
177 174
178 return list_first_entry(&group->notification_list, 175 return list_first_entry(&group->notification_list,
179 struct fsnotify_event, list); 176 struct fsnotify_event, list);