Re: "BUG: scheduling while atomic: pdflush/30/0x00000002" inlatest git

From: Dave Kleikamp
Date: Thu Jan 08 2009 - 09:38:28 EST


Adding cc:lix-fsdevel

On Thu, 2009-01-08 at 16:07 +0800, Grissiom wrote:
> When I using the latest git version, I occasionally got this in dmesg:
>
> [ 2008.237234] BUG: scheduling while atomic: pdflush/30/0x00000002
> [ 2008.237240] 2 locks held by pdflush/30:
> [ 2008.237244] #0: (mutex){--..}, at: [<c01a57a1>] sync_filesystems+0x11/0x120
> [ 2008.237258] #1: (sb_lock){--..}, at: [<c01a57ab>]
> sync_filesystems+0x1b/0x120
> [ 2008.237277] Modules linked in: fuse ricoh_mmc b43
> [ 2008.237288] Pid: 30, comm: pdflush Not tainted
> 2.6.28-g14-rfkill-nophy-ledon-07485-g9e42d0c #62
> [ 2008.237294] Call Trace:
> [ 2008.237303] [<c04d7576>] schedule+0x326/0x8e0
> [ 2008.237311] [<c01500d3>] __lock_acquire+0x293/0xa20
> [ 2008.237321] [<c014e307>] mark_held_locks+0x67/0x80
> [ 2008.237330] [<c04da58c>] _spin_unlock_irqrestore+0x4c/0x60
> [ 2008.237339] [<c014e519>] trace_hardirqs_on_caller+0x149/0x1a0
> [ 2008.237351] [<c0143d55>] async_synchronize_cookie_special+0xb5/0x140
> [ 2008.237362] [<c013e1a0>] autoremove_wake_function+0x0/0x40
> [ 2008.237372] [<c01a57fc>] sync_filesystems+0x6c/0x120
> [ 2008.237381] [<c017ee90>] pdflush+0x0/0x1e0
> [ 2008.237392] [<c01c0b90>] do_sync+0x20/0x60
> [ 2008.237402] [<c01c0bda>] sys_sync+0xa/0x10
> [ 2008.237412] [<c017ef9e>] pdflush+0x10e/0x1e0
> [ 2008.237420] [<c014e519>] trace_hardirqs_on_caller+0x149/0x1a0
> [ 2008.237429] [<c017de80>] laptop_flush+0x0/0x10
> [ 2008.237437] [<c013dea2>] kthread+0x42/0x70
> [ 2008.237444] [<c013de60>] kthread+0x0/0x70
> [ 2008.237452] [<c0103c03>] kernel_thread_helper+0x7/0x14
> (repeat some times)
>

The offender is
http://git.kernel.org/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=efaee192

async_synchronize_full_special() shouldn't be called while holding a
spinlock, sb_lock.

I think this patch should fix it. Arjan, would this work?

Signed-off-by: Dave Kleikamp <shaggy@xxxxxxxxxxxxxxxxxx>

diff --git a/fs/super.c b/fs/super.c
index cb20744..7d67387 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -458,7 +458,6 @@ void sync_filesystems(int wait)
if (sb->s_flags & MS_RDONLY)
continue;
sb->s_need_sync_fs = 1;
- async_synchronize_full_special(&sb->s_async_list);
}

restart:
@@ -471,6 +470,7 @@ restart:
sb->s_count++;
spin_unlock(&sb_lock);
down_read(&sb->s_umount);
+ async_synchronize_full_special(&sb->s_async_list);
if (sb->s_root && (wait || sb->s_dirt))
sb->s_op->sync_fs(sb, wait);
up_read(&sb->s_umount);

--
David Kleikamp
IBM Linux Technology Center

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/