linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhaolei <zhaolei@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Cc: Zhao Lei <zhaolei@cn.fujitsu.com>
Subject: [PATCH 3/3] btrfs: Remove BUG_ON() when failed searching block_group_cache in unpin_extent_range()
Date: Tue, 24 Feb 2015 23:37:29 +0800	[thread overview]
Message-ID: <1424792249-26672-1-git-send-email-zhaolei@cn.fujitsu.com> (raw)

From: Zhao Lei <zhaolei@cn.fujitsu.com>

Above BUG_ON() was triggered only one time in my test, but hadn't
happened again in same env.

The reason maybe:
A block group which include pinned space was removed before
unpin_extent_range(), and no other block_group_cache after
"start" pos, so the code entered into above BUG_ON().

To support auto-remove-bgs, we can remove above BUG_ON(), and bypass
removed bgs.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
 fs/btrfs/extent-tree.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 8b51eb5..ef0b40d 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -5751,7 +5751,8 @@ static int unpin_extent_range(struct btrfs_root *root, u64 start, u64 end,
 			if (cache)
 				btrfs_put_block_group(cache);
 			cache = btrfs_lookup_block_group(fs_info, start);
-			BUG_ON(!cache); /* Logic error */
+			if (!cache)
+				break;
 		}
 
 		len = cache->key.objectid + cache->key.offset - start;
-- 
1.8.5.1


             reply	other threads:[~2015-02-24 15:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24 15:37 Zhaolei [this message]
2015-02-24 16:01 ` [PATCH 3/3] btrfs: Remove BUG_ON() when failed searching block_group_cache in unpin_extent_range() Filipe David Manana
2015-02-25  1:18   ` Zhao Lei
2015-02-26  9:55     ` Filipe David Manana
2015-02-26 12:03       ` Zhao Lei

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=1424792249-26672-1-git-send-email-zhaolei@cn.fujitsu.com \
    --to=zhaolei@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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).