From patchwork Mon May 23 11:57:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elric Milon X-Patchwork-Id: 808452 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4NBvn75007968 for ; Mon, 23 May 2011 11:57:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754309Ab1EWL5r (ORCPT ); Mon, 23 May 2011 07:57:47 -0400 Received: from mailout-eu.gmx.com ([213.165.64.42]:50101 "HELO mailout-eu.gmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754085Ab1EWL5q (ORCPT ); Mon, 23 May 2011 07:57:46 -0400 Received: (qmail invoked by alias); 23 May 2011 11:57:44 -0000 Received: from 58.222.221.87.dynamic.jazztel.es (EHLO screw.localnet) [87.221.222.58] by mail.gmx.com (mp-eu002) with SMTP; 23 May 2011 13:57:44 +0200 X-Authenticated: #63813469 X-Provags-ID: V01U2FsdGVkX1/OhkkV99DO+twHRuvrzlWtnGm1R8oxUu17xTWNyw RNE4FsHeqA39To From: Elric Milon To: "linux-btrfs" Subject: Re: kernel BUG at fs/btrfs/inode.c:149! Date: Mon, 23 May 2011 13:57:41 +0200 User-Agent: KMail/1.13.7 (Linux/2.6.39-1-amd64; KDE/4.6.2; x86_64; ; ) References: <201105051954.48405.whirm@gmx.com> <201105161701.11645.truewhirm@yahoo.es> <4DD150C1.2090505@redhat.com> In-Reply-To: <4DD150C1.2090505@redhat.com> MIME-Version: 1.0 Message-Id: <201105231357.41588.whirm@gmx.com> X-Y-GMX-Trusted: 0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 23 May 2011 11:57:50 +0000 (UTC) On Monday 16 May 2011 18:28:49 you wrote: > On 05/16/2011 11:01 AM, Whirm wrote: > > On Monday 16 May 2011 16:11:19 Josef Bacik wrote: > > > > Sorry yes, I meant this is how I managed to get the corrupted filesystem. > > > > Ill try to break it again. > > Oh ok perfect, yeah I will try and do the same sort of things and see if > I can get it to happen as well. Thanks, Great, btw, I tried to see if I can mount the corrupted filesystem with the patch you told me about applied, and it fails, here's the log: http://pastebin.com/raw.php?i=4Kfv927B That happens using 2.6.39-rc7+ from git with the following patch applied (its the debug patch and the possible fix you told me about): e->bitmap = kzalloc(PAGE_CACHE_SIZE, GFP_NOFS); if (!e->bitmap) { @@ -430,7 +439,17 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info, unlock_page(page); page_cache_release(page); goto free_cache; + if (ret) { + printk(KERN_ERR "Duplicate entries in " + "free space cache, dumping\n"); + kunmap(page); + unlock_page(page); + page_cache_release(page); + goto free_cache; + } } + printk(KERN_ERR "adding bitmap [%llu-%llu]\n", + e->offset, e->bytes); spin_lock(&block_group->tree_lock); ret = link_free_space(block_group, e); block_group->total_bitmaps++; @@ -909,10 +928,16 @@ static int tree_insert_offset(struct rb_root *root, u64 offset, * logically. */ if (bitmap) { - WARN_ON(info->bitmap); + if (info->bitmap) { + WARN_ON_ONCE(1); + return -EEXIST; + } p = &(*p)->rb_right; } else { - WARN_ON(!info->bitmap); + if (!info->bitmap) { + WARN_ON_ONCE(1); + return -EEXIST; + } p = &(*p)->rb_left; } } Do you want me to try some other patch before I destroy the filesystem to make the other tests? Thanks, diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 63731a1..419f91f 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -417,10 +417,19 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info, } if (entry->type == BTRFS_FREE_SPACE_EXTENT) { + printk(KERN_ERR "adding extent [%llu-%llu]\n", + e->offset, e->bytes); spin_lock(&block_group->tree_lock); ret = link_free_space(block_group, e); spin_unlock(&block_group->tree_lock); - BUG_ON(ret); + if (ret) { + printk(KERN_ERR "Duplicate entries in " + "free space cache, dumping\n"); + kunmap(page); + unlock_page(page); + page_cache_release(page); + goto free_cache; + } } else {