On Tue, 20 Sep 2016 11:10:35 +1000 Michael Ellerman <m...@ellerman.id.au> wrote:

> Jan Kara <j...@suse.cz> writes:
> > On Fri 16-09-16 04:10:38, Guenter Roeck wrote:
> >> On 09/15/2016 11:45 PM, Jan Kara wrote:
> >> >On Thu 15-09-16 19:20:10, Guenter Roeck wrote:
> >> >>I see various architectures crashing in -next with the following error.
> >> >>------------[ cut here ]------------
> >> >>kernel BUG at fs/notify/notification.c:66!
> >>
> >> >correct" - famous last words ;). I've seen zero-day robot complain as well
> >> >so I'll try the config it had sent me and see what's going on (likely
> >> >spin_is_locked() does not do what I thought under some configs...).
> >> 
> >> Your builds are probably all SMP builds. Looks like this happens if SMP
> >> is disabled.
> >
> > Right, that was the problem. spin_is_locked() without CONFIG_SPINLOCK_DEBUG
> > returns always 0.
> 
> Can we get this fixed soon please? It's breaking all my CI runs.
> 

It should be fixed in next -next.

From: Jan Kara <j...@suse.cz>
Subject: fsnotify-convert-notification_mutex-to-a-spinlock-fix

This is a fixed version of the patch that fixes the BUG_ON hitting on UP
kernels.

Link: http://lkml.kernel.org/r/1474031567-1831-1-git-send-email-j...@suse.cz
Signed-off-by: Jan Kara <j...@suse.cz>
Reviewed-by: Lino Sanfilippo <linosanfili...@gmx.de>
Tested-by: Guenter Roeck <li...@roeck-us.net>
Signed-off-by: Andrew Morton <a...@linux-foundation.org>
---

 fs/notify/fanotify/fanotify_user.c |    3 ++-
 fs/notify/notification.c           |    9 ++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff -puN 
fs/notify/fanotify/fanotify_user.c~fsnotify-convert-notification_mutex-to-a-spinlock-fix
 fs/notify/fanotify/fanotify_user.c
--- 
a/fs/notify/fanotify/fanotify_user.c~fsnotify-convert-notification_mutex-to-a-spinlock-fix
+++ a/fs/notify/fanotify/fanotify_user.c
@@ -54,7 +54,8 @@ struct kmem_cache *fanotify_perm_event_c
 static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
                                            size_t count)
 {
-       BUG_ON(!spin_is_locked(&group->notification_lock));
+       BUG_ON(IS_ENABLED(CONFIG_SMP) &&
+              !spin_is_locked(&group->notification_lock));
 
        pr_debug("%s: group=%p count=%zd\n", __func__, group, count);
 
diff -puN 
fs/notify/notification.c~fsnotify-convert-notification_mutex-to-a-spinlock-fix 
fs/notify/notification.c
--- 
a/fs/notify/notification.c~fsnotify-convert-notification_mutex-to-a-spinlock-fix
+++ a/fs/notify/notification.c
@@ -63,7 +63,8 @@ EXPORT_SYMBOL_GPL(fsnotify_get_cookie);
 /* return true if the notify queue is empty, false otherwise */
 bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group)
 {
-       BUG_ON(!spin_is_locked(&group->notification_lock));
+       BUG_ON(IS_ENABLED(CONFIG_SMP) &&
+              !spin_is_locked(&group->notification_lock));
        return list_empty(&group->notification_list) ? true : false;
 }
 
@@ -139,7 +140,8 @@ struct fsnotify_event *fsnotify_remove_f
 {
        struct fsnotify_event *event;
 
-       BUG_ON(!spin_is_locked(&group->notification_lock));
+       BUG_ON(IS_ENABLED(CONFIG_SMP) &&
+              !spin_is_locked(&group->notification_lock));
 
        pr_debug("%s: group=%p\n", __func__, group);
 
@@ -161,7 +163,8 @@ struct fsnotify_event *fsnotify_remove_f
  */
 struct fsnotify_event *fsnotify_peek_first_event(struct fsnotify_group *group)
 {
-       BUG_ON(!spin_is_locked(&group->notification_lock));
+       BUG_ON(IS_ENABLED(CONFIG_SMP) &&
+              !spin_is_locked(&group->notification_lock));
 
        return list_first_entry(&group->notification_list,
                                struct fsnotify_event, list);
_

Reply via email to