All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Mason <clm@fb.com>
To: Forrest Liu <forrestl@synology.com>
Cc: <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH v3] Btrfs: fix BUG_ON in btrfs_orphan_add() when delete unused block group
Date: Tue, 17 Feb 2015 09:55:53 -0500	[thread overview]
Message-ID: <1424184953.18101.1@mail.thefacebook.com> (raw)
In-Reply-To: <1423635852-23258-1-git-send-email-forrestl@synology.com>

On Wed, Feb 11, 2015 at 1:24 AM, Forrest Liu <forrestl@synology.com> 
wrote:
> Removing large amount of block group in a transaction may encounters
> BUG_ON() in btrfs_orphan_add(). That is because 
> btrfs_orphan_reserve_metadata()
> will grab metadata reservation from transaction handle, and
> btrfs_delete_unused_bgs() didn't reserve metadata for trnasaction 
> handle when
> delete unused block group.
> 
> The problem can be reproduce by following script
> 
>     mntpath=/btrfs
>     loopdev=/dev/loop0
>     filepath=/home/forrest/image
> 
>     umount $mntpath
>     losetup -d $loopdev
>     truncate --size 1000g $filepath
>     losetup $loopdev $filepath
>     mkfs.btrfs -f $loopdev
>     mount $loopdev $mntpath
> 
>     for j in `seq 1 1 1000`; do
>         fallocate -l 1g $mntpath/$j
>     done
>     # wait cleaner thread remove unused block group
>     sleep 300
> 
> The call trace that results from the BUG_ON() is:
> 
> [  613.093084] ------------[ cut here ]------------
> [  613.097928] kernel BUG at fs/btrfs/inode.c:3142!

This should fix a hard to trigger bug we've seen in production here.  I 
was on a different (wrong) track for explaining it, so your timing is 
excellent.

Thanks.

-chris




      reply	other threads:[~2015-02-17 14:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-11  6:24 [PATCH v3] Btrfs: fix BUG_ON in btrfs_orphan_add() when delete unused block group Forrest Liu
2015-02-17 14:55 ` Chris Mason [this message]

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=1424184953.18101.1@mail.thefacebook.com \
    --to=clm@fb.com \
    --cc=forrestl@synology.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.