linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miao Xie <miaox@cn.fujitsu.com>
To: Itaru Kitayama <kitayama@cl.bb4u.ne.jp>
Cc: Chris Mason <chris.mason@oracle.com>,
	Linux Btrfs <linux-btrfs@vger.kernel.org>,
	David Sterba <dave@jikos.cz>, Ito <t-itoh@jp.fujitsu.com>
Subject: Re: [PATCH V4] btrfs: implement delayed inode items operation
Date: Wed, 23 Mar 2011 17:47:01 +0800	[thread overview]
Message-ID: <4D89C195.6020200@cn.fujitsu.com> (raw)
In-Reply-To: <20110323131918.0feda83a.kitayama@cl.bb4u.ne.jp>

[-- Attachment #1: Type: text/plain, Size: 3612 bytes --]

Hi, Kitayama-san

On wed, 23 Mar 2011 13:19:18 +0900, Itaru Kitayama wrote:
> On Wed, 23 Mar 2011 12:00:38 +0800
> Miao Xie <miaox@cn.fujitsu.com> wrote:
> 
>> I is testing the new version, in which I fixed the slab shrinker problem reported by
>> Chris. In the new version, the delayed node is removed before the relative inode is
>> moved into the unused_inode list(the slab shrinker will reclaim inodes in this list).
>> Maybe this method can also fix this bug. So could you tell me the reproduce step
>> or the options of mkfs and mount? I will check if the new patch can fix this bug or not.
> 
> I used the default mkfs options for $TEST_DEV and enabled the space_cache and the
> compress=lzo options upon mounting the partition.

Unfortunately, I can trigger this warning, but by analyzing the following information,

> =========================================================
> [ INFO: possible irq lock inversion dependency detected ]
> 2.6.36-xie+ #122
> ---------------------------------------------------------
> kswapd0/49 just changed the state of lock:
>  (iprune_sem){++++.-}, at: [<ffffffff811316d0>] shrink_icache_memory+0x4d/0x213
> but this lock took another, RECLAIM_FS-unsafe lock in the past:
>  (&delayed_node->mutex){+.+.+.}
> 
> and interrupts could create inverse lock ordering between them.
[SNIP]
>     RECLAIM_FS-ON-W at:
>                              [<ffffffff81074292>] mark_held_locks+0x52/0x70
>                              [<ffffffff81074354>] lockdep_trace_alloc+0xa4/0xc2
>                              [<ffffffff8110f206>] __kmalloc+0x7f/0x154
>                              [<ffffffff811c2c21>] kzalloc+0x14/0x16
>                              [<ffffffff811c5e83>] cache_block_group+0x106/0x238
>                              [<ffffffff811c7069>] find_free_extent+0x4e2/0xa86
>                              [<ffffffff811c76c1>] btrfs_reserve_extent+0xb4/0x142
>                              [<ffffffff811c78b6>] btrfs_alloc_free_block+0x167/0x2af
>                              [<ffffffff811be610>] __btrfs_cow_block+0x103/0x346
>                              [<ffffffff811bedb8>] btrfs_cow_block+0x101/0x110
>                              [<ffffffff811c05d8>] btrfs_search_slot+0x143/0x513
>                              [<ffffffff811cf5ab>] btrfs_lookup_inode+0x2f/0x8f
>                              [<ffffffff81212405>] btrfs_update_delayed_inode+0x75/0x135
>                              [<ffffffff8121340d>] btrfs_run_delayed_items+0xd6/0x131
>                              [<ffffffff811d64d7>] btrfs_commit_transaction+0x28b/0x668
>                              [<ffffffff811ba786>] btrfs_sync_fs+0x6b/0x70
>                              [<ffffffff81140265>] __sync_filesystem+0x6b/0x83
>                              [<ffffffff81140347>] sync_filesystem+0x4c/0x50
>                              [<ffffffff8111fc56>] generic_shutdown_super+0x27/0xd7
>                              [<ffffffff8111fd5b>] kill_anon_super+0x16/0x54
>                              [<ffffffff8111effd>] deactivate_locked_super+0x26/0x46
>                              [<ffffffff8111f495>] deactivate_super+0x45/0x4a
>                              [<ffffffff81135962>] mntput_no_expire+0xd6/0x104
>                              [<ffffffff81136a87>] sys_umount+0x2c1/0x2ec
>                              [<ffffffff81002ddb>] system_call_fastpath+0x16/0x1b

we found GFP_KERNEL was passed into kzalloc(), I think this flag trigger the above lockdep
warning. the attached patch, which against the delayed items operation patch, may fix this
problem, Could you test it for me?

Thanks
Miao

[-- Attachment #2: 0001-btrfs-use-GFP_NOFS-instead-of-GFP_KERNEL.patch --]
[-- Type: text/plain, Size: 953 bytes --]

>From f84daee1d2060beae945a2774cda7af2ef7f3e61 Mon Sep 17 00:00:00 2001
From: Miao Xie <miaox@cn.fujitsu.com>
Date: Wed, 23 Mar 2011 16:01:16 +0800
Subject: [PATCH] btrfs: use GFP_NOFS instead of GFP_KERNEL

In the filesystem context, we must allocate memory by GFP_NOFS,
or we will start another filesystem operation and trigger lockdep warnning.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
 fs/btrfs/extent-tree.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index f1db57d..fe50cff 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -471,7 +471,7 @@ static int cache_block_group(struct btrfs_block_group_cache *cache,
 	if (load_cache_only)
 		return 0;
 
-	caching_ctl = kzalloc(sizeof(*caching_ctl), GFP_KERNEL);
+	caching_ctl = kzalloc(sizeof(*caching_ctl), GFP_NOFS);
 	BUG_ON(!caching_ctl);
 
 	INIT_LIST_HEAD(&caching_ctl->list);
-- 
1.7.3.1


  reply	other threads:[~2011-03-23  9:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-18  9:24 [PATCH V4] btrfs: implement delayed inode items operation Miao Xie
2011-03-21  0:33 ` Chris Mason
2011-03-21  5:05   ` Miao Xie
2011-03-21 12:08     ` Chris Mason
2011-03-23  1:57       ` Miao Xie
2011-03-23 14:20         ` Miao Xie
2011-03-22  2:33 ` Itaru Kitayama
2011-03-22  3:12   ` Miao Xie
2011-03-22  3:50     ` Itaru Kitayama
2011-03-22 10:03       ` Miao Xie
2011-03-22 13:33         ` Itaru Kitayama
2011-03-23  1:27           ` Miao Xie
2011-03-23  3:24             ` Itaru Kitayama
2011-03-23  4:00               ` Miao Xie
2011-03-23  4:19                 ` Itaru Kitayama
2011-03-23  9:47                   ` Miao Xie [this message]
2011-03-24  3:38                     ` Itaru Kitayama

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D89C195.6020200@cn.fujitsu.com \
    --to=miaox@cn.fujitsu.com \
    --cc=chris.mason@oracle.com \
    --cc=dave@jikos.cz \
    --cc=kitayama@cl.bb4u.ne.jp \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=t-itoh@jp.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).