From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932223AbcITBNp (ORCPT ); Mon, 19 Sep 2016 21:13:45 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56844 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751638AbcITBNo (ORCPT ); Mon, 19 Sep 2016 21:13:44 -0400 Date: Mon, 19 Sep 2016 18:13:42 -0700 From: Andrew Morton To: Michael Ellerman Cc: Jan Kara , Guenter Roeck , "linux-kernel\@vger.kernel.org" Subject: Re: Crashes in next-20160915 (BUG at fs/notify/notification.c:66!) Message-Id: <20160919181342.ef41286b6cbd45a27a5968a7@linux-foundation.org> In-Reply-To: <87vaxrs7ec.fsf@concordia.ellerman.id.au> References: <20160916064521.GF24269@quack2.suse.cz> <6ae57328-ab25-8798-51f9-9a30d9c2af70@roeck-us.net> <20160916124948.GG24269@quack2.suse.cz> <87vaxrs7ec.fsf@concordia.ellerman.id.au> X-Mailer: Sylpheed 3.4.2 (GTK+ 2.24.28; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 20 Sep 2016 11:10:35 +1000 Michael Ellerman wrote: > Jan Kara 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 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-jack@suse.cz Signed-off-by: Jan Kara Reviewed-by: Lino Sanfilippo Tested-by: Guenter Roeck Signed-off-by: Andrew Morton --- 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); _