linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Bo <liubo2009@cn.fujitsu.com>
To: Chris Mason <chris.mason@oracle.com>
Cc: Arne Jansen <sensille@gmx.net>,
	"Yan, Zheng" <zheng.z.yan@linux.intel.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, 27 Oct 2011 11:09:18 +0800	[thread overview]
Message-ID: <4EA8CB5E.50308@cn.fujitsu.com> (raw)
In-Reply-To: <1317308349-sup-2231@shiny>

On 09/29/2011 10:59 PM, Chris Mason wrote:
> 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.
> 

Hi, Chris,

Does this "force cow" way fit your expectation?  Or we need to pick another solution,
such as building a a dependency graph among snapshots?

IMO, apart from COWing more while committing a transaction, "force cow" keeps the original
snapshot batching.

thanks,
liubo

> -chris
> 


      reply	other threads:[~2011-10-27  3:09 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
2011-10-27  3:09           ` Liu Bo [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=4EA8CB5E.50308@cn.fujitsu.com \
    --to=liubo2009@cn.fujitsu.com \
    --cc=chris.mason@oracle.com \
    --cc=dave@jikos.cz \
    --cc=josef@redhat.com \
    --cc=linux-btrfs@vger.kernel.org \
    --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).