Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753913AbZDZQjT (ORCPT ); Sun, 26 Apr 2009 12:39:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752781AbZDZQjH (ORCPT ); Sun, 26 Apr 2009 12:39:07 -0400 Received: from mx3.mail.elte.hu ([157.181.1.138]:56652 "EHLO mx3.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752682AbZDZQjE (ORCPT ); Sun, 26 Apr 2009 12:39:04 -0400 Date: Sun, 26 Apr 2009 18:38:41 +0200 From: Ingo Molnar To: Alessio Igor Bogani , Neil Brown Cc: Jonathan Corbet , =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , Peter Zijlstra , LKML Subject: Re: [PATCH -tip] md: Avoid to call flush_scheduled_work() with BKL held Message-ID: <20090426163841.GC6236@elte.hu> References: <1240492313-6560-1-git-send-email-abogani@texware.it> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1240492313-6560-1-git-send-email-abogani@texware.it> User-Agent: Mutt/1.5.18 (2008-05-17) X-ELTE-VirusStatus: clean X-ELTE-SpamScore: -1.5 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=-1.5 required=5.9 tests=BAYES_00 autolearn=no SpamAssassin version=3.2.3 -1.5 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3910 Lines: 91 * Alessio Igor Bogani wrote: > [ 1.479872] ------------[ cut here ]------------ > [ 1.483391] WARNING: at kernel/workqueue.c:408 flush_workqueue+0x7b/0x11f() > [ 1.489948] Hardware name: > [ 1.491779] Modules linked in: > [ 1.493306] Pid: 1, comm: swapper Not tainted 2.6.30-rc1 #67 > [ 1.495767] Call Trace: > [ 1.496974] [] warn_slowpath+0xd8/0x10c > [ 1.503432] [] ? save_stack_trace+0x2f/0x4d > [ 1.509724] [] ? mark_lock+0x22/0x22c > [ 1.515412] [] ? __lock_acquire+0xc36/0xc45 > [ 1.521448] [] ? debug_check_no_locks_freed+0x120/0x12f > [ 1.525189] [] ? get_lock_stats+0x19/0x4c > [ 1.527172] [] ? put_lock_stats+0x28/0x33 > [ 1.533316] [] flush_workqueue+0x7b/0x11f > [ 1.539224] [] ? mddev_find+0xe2/0x2e5 > [ 1.544826] [] flush_scheduled_work+0x15/0x17 > [ 1.551262] [] md_alloc+0x4e/0x2b0 > [ 1.556505] [] md_probe+0x10/0x14 > [ 1.561939] [] kobj_lookup+0x150/0x194 > [ 1.566607] [] ? md_probe+0x0/0x14 > [ 1.570519] [] get_gendisk+0x30/0xc1 > [ 1.573948] [] __blkdev_get+0x3a/0x338 > [ 1.577537] [] ? blkdev_open+0x0/0xab > [ 1.581293] [] blkdev_get+0x10/0x12 > [ 1.584922] [] blkdev_open+0x76/0xab > [ 1.588661] [] __dentry_open+0x194/0x2b9 > [ 1.592615] [] nameidata_to_filp+0x46/0x57 > [ 1.596730] [] do_filp_open+0x417/0x83e > [ 1.600651] [] ? get_lock_stats+0x19/0x4c > [ 1.604597] [] ? alloc_fd+0x122/0x133 > [ 1.608424] [] do_sys_open+0x58/0xd8 > [ 1.612233] [] sys_open+0x20/0x22 > [ 1.615671] [] md_run_setup+0x64/0x8e > [ 1.619496] [] prepare_namespace+0x3a/0x19d > [ 1.623239] [] kernel_init+0x16e/0x17e > [ 1.626923] [] child_rip+0xa/0x20 > [ 1.629504] [] ? finish_task_switch+0x40/0xe8 > [ 1.642356] [] ? restore_args+0x0/0x30 > [ 1.643802] [] ? kernel_init+0x0/0x17e > [ 1.645276] [] ? child_rip+0x0/0x20 > [ 1.648839] ---[ end trace 6fa921fb3766f01d ]--- > > Signed-off-by: Alessio Igor Bogani > --- > drivers/md/md.c | 6 ++++++ > 1 files changed, 6 insertions(+), 0 deletions(-) > > diff --git a/drivers/md/md.c b/drivers/md/md.c > index ed5727c..e6c039c 100644 > --- a/drivers/md/md.c > +++ b/drivers/md/md.c > @@ -45,6 +45,7 @@ > #include > #include > #include > +#include > #include > #include > #include "md.h" > @@ -3830,6 +3831,7 @@ static int md_alloc(dev_t dev, char *name) > int shift; > int unit; > int error; > + int bkl = kernel_locked(); > > if (!mddev) > return -ENODEV; > @@ -3841,7 +3843,11 @@ static int md_alloc(dev_t dev, char *name) > /* wait for any previous instance if this device > * to be completed removed (mddev_delayed_delete). > */ > + if (bkl) > + unlock_kernel(); > flush_scheduled_work(); > + if (bkl) > + lock_kernel(); Hm, couldnt we switch the ioctl in drivers/md/md.c from ->locked_ioctl to ->unlocked_ioctl? Neil, what do you think? Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/