linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Mason <chris.mason@oracle.com>
To: Arne Jansen <sensille@gmx.net>
Cc: "Yan, Zheng" <zheng.z.yan@linux.intel.com>,
	Liu Bo <liubo2009@cn.fujitsu.com>,
	linux-btrfs <linux-btrfs@vger.kernel.org>,
	josef <josef@redhat.com>, lizf <lizf@cn.fujitsu.com>,
	miaox <miaox@cn.fujitsu.com>, dave <dave@jikos.cz>
Subject: Re: [PATCH] Btrfs: fix tree corruption after multi-thread snapshots and inode cache flush
Date: Thu, 29 Sep 2011 10:59:46 -0400	[thread overview]
Message-ID: <1317308349-sup-2231@shiny> (raw)
In-Reply-To: <4E842EFE.40205@gmx.net>

Excerpts from Arne Jansen's message of 2011-09-29 04:40:30 -0400:
> On 29.09.2011 10:36, Yan, Zheng wrote:
> > On 09/29/2011 04:18 PM, Liu Bo wrote:
> >> On 09/29/2011 12:25 PM, Yan, Zheng wrote:
> >>> On 09/29/2011 10:00 AM, Liu Bo wrote:
> >>>> The btrfs snapshotting code requires that once a root has been
> >>>> snapshotted, we don't change it during a commit.
> >>>>
> >>>> But there are two cases to lead to tree corruptions:
> >>>>
> >>>> 1) multi-thread snapshots can commit serveral snapshots in a transaction,
> >>>>    and this may change the src root when processing the following pending
> >>>>    snapshots, which lead to the former snapshots corruptions;
> >>>>
> >>>> 2) the free inode cache was changing the roots when it root the cache,
> >>>>    which lead to corruptions.
> >>>>
> >>> For the case 2, the free inode cache of newly created snapshot is invalid.
> >>> So it's better to avoid modifying snapshotted trees.
> >>>
> >>
> >> For case 2, with flushing dirty inode cache during create_pending_snapshot,
> >> we can avoid modifying snapshotted trees as your advice.
> >>
> >> But for case 1, I have no idea how to do the same thing, since we are not
> >> allowed to commit per snapshot, which will make the performance terrible.
> 
> One snapshot per subvol per transaction is ok, but it must be possible to create
> hundreds or thousands of snapshots for different subvols within one transaction.
> Imagine a setup with 10000 subvols and creating one snapshot per hour.

Agreed, we need to be able to do more than one snapshot per commit.  Our
current commits are pretty heavy, we do need to be able to batch them.

-chris

  reply	other threads:[~2011-09-29 14:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-29  2:00 [PATCH] Btrfs: fix tree corruption after multi-thread snapshots and inode cache flush Liu Bo
2011-09-29  4:25 ` Yan, Zheng
2011-09-29  6:47   ` Miao Xie
2011-09-29  6:46     ` Yan, Zheng
2011-09-29  7:19       ` Miao Xie
2011-09-29  7:09         ` Yan, Zheng
2011-09-29  8:18   ` Liu Bo
2011-09-29  8:36     ` Yan, Zheng
2011-09-29  8:40       ` Arne Jansen
2011-09-29 14:59         ` Chris Mason [this message]
2011-10-27  3:09           ` Liu Bo

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=1317308349-sup-2231@shiny \
    --to=chris.mason@oracle.com \
    --cc=dave@jikos.cz \
    --cc=josef@redhat.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=liubo2009@cn.fujitsu.com \
    --cc=lizf@cn.fujitsu.com \
    --cc=miaox@cn.fujitsu.com \
    --cc=sensille@gmx.net \
    --cc=zheng.z.yan@linux.intel.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).