linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miao Xie <miaox@cn.fujitsu.com>
To: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>,
	Linux Btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 2/2] Btrfs: fix the snapshot that should not exist
Date: Mon, 30 Jul 2012 18:27:50 +0800	[thread overview]
Message-ID: <501661A6.7040301@cn.fujitsu.com> (raw)
In-Reply-To: <20120727122957.GL17430@twin.jikos.cz>

On 	fri, 27 Jul 2012 14:29:57 +0200, David Sterba wrote:
> On Fri, Jul 27, 2012 at 04:52:21PM +0900, Hidetoshi Seto wrote:
>> (2012/07/26 15:57), Miao Xie wrote:
>>>  	btrfs_abort_transaction(trans, root, ret);
>>>  	goto fail;
>>>  }
>>> @@ -1386,13 +1408,13 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
>>>  	 */
>>>  	mutex_lock(&root->fs_info->reloc_mutex);
>>>  
>>> -	ret = btrfs_run_delayed_items(trans, root);
>>> +	ret = create_pending_snapshots(trans, root->fs_info);
>>>  	if (ret) {
>>>  		mutex_unlock(&root->fs_info->reloc_mutex);
>>>  		goto cleanup_transaction;
>>>  	}
>>>  
>>> -	ret = create_pending_snapshots(trans, root->fs_info);
>>> +	ret = btrfs_run_delayed_items(trans, root);
>>>  	if (ret) {
>>>  		mutex_unlock(&root->fs_info->reloc_mutex);
>>>  		goto cleanup_transaction;
>>
>> It would be nice to have a patch description to tell why you
>> have to change the order here.
> 
> Not only nice but necessary, as this order will cause corruption under
> certain conditions. I'd like to hear the reason behind.

What you worried is the corruption of the snapshots, right?
It is impossible because we will flush all the delayed items before the
creation of the snapshot(in create_pending_snapshot()). and we also will
force the tree to COW if we want to change it after it is snapshoted.
These two method will make sure the snapshots is healthy.

Thanks
Miao

  reply	other threads:[~2012-07-30 10:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-26  6:57 [PATCH 2/2] Btrfs: fix the snapshot that should not exist Miao Xie
2012-07-27  7:52 ` Hidetoshi Seto
2012-07-27 12:29   ` David Sterba
2012-07-30 10:27     ` Miao Xie [this message]
2012-07-30 10:01   ` Miao Xie

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=501661A6.7040301@cn.fujitsu.com \
    --to=miaox@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=seto.hidetoshi@jp.fujitsu.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).