Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755336Ab0A1Mxj (ORCPT ); Thu, 28 Jan 2010 07:53:39 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754702Ab0A1Mxi (ORCPT ); Thu, 28 Jan 2010 07:53:38 -0500 Received: from mail-fx0-f220.google.com ([209.85.220.220]:60162 "EHLO mail-fx0-f220.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753730Ab0A1Mxh (ORCPT ); Thu, 28 Jan 2010 07:53:37 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=ZLTVT19vaZwL+hvr+AENCtclLBSzrvq6YMHF3JWgDml0cLf3eniV/JNmrEF2UHgiQR f9QNL7Kpz+bZs4BRnneaBTdbps6eHvUiGBvXklYX5UdAZd/OizxntRSneIuazWNZDt2F q1eCFkmL/KSapj5+dNYWXK0hKRsFHvA4gim9Q= Date: Thu, 28 Jan 2010 13:53:34 +0100 From: Frederic Weisbecker To: Alexander Beregalov Cc: Linux Kernel Mailing List , Christian Kujau , Chris Mason Subject: [PATCH] reiserfs: Fix vmalloc call under reiserfs lock Message-ID: <20100128125332.GC5074@nowhere> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 8191 Lines: 212 On Sun, Jan 24, 2010 at 09:44:25PM +0300, Alexander Beregalov wrote: > Hi Frederic > > Here is another warning: > > [ INFO: inconsistent lock state ] > 2.6.33-rc5 #1 > --------------------------------- > inconsistent {RECLAIM_FS-ON-W} -> {IN-RECLAIM_FS-W} usage. > kswapd0/313 [HC0[0]:SC0[0]:HE1:SE1] takes: > (&REISERFS_SB(s)->lock){+.+.?.}, at: [] > reiserfs_write_lock_once+0x28/0x50 > {RECLAIM_FS-ON-W} state was registered at: > [] mark_held_locks+0x62/0x90 > [] lockdep_trace_alloc+0x9a/0xc0 > [] kmem_cache_alloc+0x26/0xf0 > [] __get_vm_area_node+0x6c/0xf0 > [] __vmalloc_node+0x7e/0xa0 > [] vmalloc+0x2b/0x30 > [] journal_init+0x6cb/0xa10 > [] reiserfs_fill_super+0x342/0xb80 > [] get_sb_bdev+0x145/0x180 > [] get_super_block+0x21/0x30 > [] vfs_kern_mount+0x40/0xd0 > [] do_kern_mount+0x39/0xd0 > [] do_mount+0x2c7/0x6d0 > [] sys_mount+0x66/0xa0 > [] mount_block_root+0xc4/0x245 > [] mount_root+0x59/0x5f > [] prepare_namespace+0x111/0x14b > [] kernel_init+0xcf/0xdb > [] kernel_thread_helper+0x6/0x1c > irq event stamp: 63236801 > hardirqs last enabled at (63236801): [] > __mutex_unlock_slowpath+0x9a/0x120 > hardirqs last disabled at (63236800): [] > __mutex_unlock_slowpath+0x39/0x120 > softirqs last enabled at (63218800): [] __do_softirq+0xc1/0x110 > softirqs last disabled at (63218789): [] do_softirq+0x4d/0x60 > > other info that might help us debug this: > 2 locks held by kswapd0/313: > #0: (shrinker_rwsem){++++..}, at: [] shrink_slab+0x24/0x170 > #1: (&type->s_umount_key#19){++++..}, at: [] > shrink_dcache_memory+0xfd/0x1a0 > > stack backtrace: > Pid: 313, comm: kswapd0 Not tainted 2.6.33-rc5 #1 > Call Trace: > [] ? printk+0x18/0x1c > [] print_usage_bug+0x15f/0x1a0 > [] mark_lock+0x39f/0x5a0 > [] ? trace_hardirqs_off+0xb/0x10 > [] ? check_usage_forwards+0x0/0xf0 > [] __lock_acquire+0x214/0xa70 > [] ? sched_clock_cpu+0x95/0x110 > [] lock_acquire+0x7a/0xa0 > [] ? reiserfs_write_lock_once+0x28/0x50 > [] mutex_lock_nested+0x5f/0x2b0 > [] ? reiserfs_write_lock_once+0x28/0x50 > [] ? reiserfs_write_lock_once+0x28/0x50 > [] reiserfs_write_lock_once+0x28/0x50 > [] reiserfs_delete_inode+0x50/0x140 > [] ? generic_delete_inode+0x5f/0x150 > [] ? reiserfs_delete_inode+0x0/0x140 > [] generic_delete_inode+0x9c/0x150 > [] generic_drop_inode+0x3d/0x60 > [] iput+0x47/0x50 > [] dentry_iput+0x6f/0xf0 > [] d_kill+0x24/0x50 > [] __shrink_dcache_sb+0x21d/0x2b0 > [] shrink_dcache_memory+0x12f/0x1a0 > [] shrink_slab+0x10e/0x170 > [] kswapd+0x477/0x6a0 > [] ? isolate_pages_global+0x0/0x1b0 > [] ? autoremove_wake_function+0x0/0x40 > [] ? kswapd+0x0/0x6a0 > [] kthread+0x6c/0x80 > [] ? kthread+0x0/0x80 > [] kernel_thread_helper+0x6/0x1c Ok, I think this patch fixes the issues. Unfortunately I can't reproduce this lockdep warning, even by booting with low memory and then stress testing. I hope you can give it a try. Thanks a lot! --- >From bbec919150037b8a2e58e32d3ba642ba3b6582a5 Mon Sep 17 00:00:00 2001 From: Frederic Weisbecker Date: Thu, 28 Jan 2010 13:43:50 +0100 Subject: [PATCH] reiserfs: Fix vmalloc call under reiserfs lock Vmalloc is called to allocate journal->j_cnode_free_list but we hold the reiserfs lock at this time, which raises a {RECLAIM_FS-ON-W} -> {IN-RECLAIM_FS-W} lock inversion. Just drop the reiserfs lock at this time, as it's not even needed but kept for paranoid reasons. This fixes: [ INFO: inconsistent lock state ] 2.6.33-rc5 #1 --------------------------------- inconsistent {RECLAIM_FS-ON-W} -> {IN-RECLAIM_FS-W} usage. kswapd0/313 [HC0[0]:SC0[0]:HE1:SE1] takes: (&REISERFS_SB(s)->lock){+.+.?.}, at: [] reiserfs_write_lock_once+0x28/0x50 {RECLAIM_FS-ON-W} state was registered at: [] mark_held_locks+0x62/0x90 [] lockdep_trace_alloc+0x9a/0xc0 [] kmem_cache_alloc+0x26/0xf0 [] __get_vm_area_node+0x6c/0xf0 [] __vmalloc_node+0x7e/0xa0 [] vmalloc+0x2b/0x30 [] journal_init+0x6cb/0xa10 [] reiserfs_fill_super+0x342/0xb80 [] get_sb_bdev+0x145/0x180 [] get_super_block+0x21/0x30 [] vfs_kern_mount+0x40/0xd0 [] do_kern_mount+0x39/0xd0 [] do_mount+0x2c7/0x6d0 [] sys_mount+0x66/0xa0 [] mount_block_root+0xc4/0x245 [] mount_root+0x59/0x5f [] prepare_namespace+0x111/0x14b [] kernel_init+0xcf/0xdb [] kernel_thread_helper+0x6/0x1c irq event stamp: 63236801 hardirqs last enabled at (63236801): [] __mutex_unlock_slowpath+0x9a/0x120 hardirqs last disabled at (63236800): [] __mutex_unlock_slowpath+0x39/0x120 softirqs last enabled at (63218800): [] __do_softirq+0xc1/0x110 softirqs last disabled at (63218789): [] do_softirq+0x4d/0x60 other info that might help us debug this: 2 locks held by kswapd0/313: #0: (shrinker_rwsem){++++..}, at: [] shrink_slab+0x24/0x170 #1: (&type->s_umount_key#19){++++..}, at: [] shrink_dcache_memory+0xfd/0x1a0 stack backtrace: Pid: 313, comm: kswapd0 Not tainted 2.6.33-rc5 #1 Call Trace: [] ? printk+0x18/0x1c [] print_usage_bug+0x15f/0x1a0 [] mark_lock+0x39f/0x5a0 [] ? trace_hardirqs_off+0xb/0x10 [] ? check_usage_forwards+0x0/0xf0 [] __lock_acquire+0x214/0xa70 [] ? sched_clock_cpu+0x95/0x110 [] lock_acquire+0x7a/0xa0 [] ? reiserfs_write_lock_once+0x28/0x50 [] mutex_lock_nested+0x5f/0x2b0 [] ? reiserfs_write_lock_once+0x28/0x50 [] ? reiserfs_write_lock_once+0x28/0x50 [] reiserfs_write_lock_once+0x28/0x50 [] reiserfs_delete_inode+0x50/0x140 [] ? generic_delete_inode+0x5f/0x150 [] ? reiserfs_delete_inode+0x0/0x140 [] generic_delete_inode+0x9c/0x150 [] generic_drop_inode+0x3d/0x60 [] iput+0x47/0x50 [] dentry_iput+0x6f/0xf0 [] d_kill+0x24/0x50 [] __shrink_dcache_sb+0x21d/0x2b0 [] shrink_dcache_memory+0x12f/0x1a0 [] shrink_slab+0x10e/0x170 [] kswapd+0x477/0x6a0 [] ? isolate_pages_global+0x0/0x1b0 [] ? autoremove_wake_function+0x0/0x40 [] ? kswapd+0x0/0x6a0 [] kthread+0x6c/0x80 [] ? kthread+0x0/0x80 [] kernel_thread_helper+0x6/0x1c Reported-by: Alexander Beregalov Signed-off-by: Frederic Weisbecker Cc: Christian Kujau Cc: Chris Mason --- fs/reiserfs/journal.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 83ac4d3..ba98546 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c @@ -2913,7 +2913,9 @@ int journal_init(struct super_block *sb, const char *j_dev_name, journal->j_mount_id = 10; journal->j_state = 0; atomic_set(&(journal->j_jlock), 0); + reiserfs_write_unlock(sb); journal->j_cnode_free_list = allocate_cnodes(num_cnodes); + reiserfs_write_lock(sb); journal->j_cnode_free_orig = journal->j_cnode_free_list; journal->j_cnode_free = journal->j_cnode_free_list ? num_cnodes : 0; journal->j_cnode_used = 0; -- 1.6.2.3 -- 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/