linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <Anand.Jain@oracle.com>
To: Miao Xie <miaox@cn.fujitsu.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 01/10] Btrfs: Fix the problem that the replace destroys the seed filesystem
Date: Fri, 25 Jul 2014 15:56:44 +0800	[thread overview]
Message-ID: <53D20DBC.5030108@oracle.com> (raw)
In-Reply-To: <1406173035-29478-1-git-send-email-miaox@cn.fujitsu.com>


  Thanks for nailing down most of the seed related bugs, scratching
  off few from my list.


On 07/24/2014 11:37 AM, Miao Xie wrote:
> The seed filesystem was destroyed by the device replace, the reproduce
> method is:
>   # mkfs.btrfs -f <dev0>
>   # btrfstune -S 1 <dev0>
>   # mount <dev0> <mnt>
>   # btrfs device add <dev1> <mnt>
>   # umount <mnt>
>   # mount <dev1> <mnt>
>   # btrfs replace start -f <dev0> <dev2> <mnt>
>   # umount <mnt>
>   # mount <dev0> <mnt>
>
> It is because we erase the super block on the seed device. It is wrong,
> we should not change anything on the seed device.

nice fix.

Reviewed-by: Anand Jain <anand.jain@oracle.com>

> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
> ---
>   fs/btrfs/volumes.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 2776070f..19188df 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -1853,8 +1853,12 @@ void btrfs_rm_dev_replace_srcdev(struct btrfs_fs_info *fs_info,
>   	if (srcdev->bdev) {
>   		fs_info->fs_devices->open_devices--;
>
> -		/* zero out the old super */
> -		btrfs_scratch_superblock(srcdev);
> +		/*
> +		 * zero out the old super if it is not writable
> +		 * (e.g. seed device)
> +		 */
> +		if (srcdev->writeable)
> +			btrfs_scratch_superblock(srcdev);
>   	}
>
>   	call_rcu(&srcdev->rcu, free_device);
>

  parent reply	other threads:[~2014-07-25  7:53 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-24  3:37 [PATCH 01/10] Btrfs: Fix the problem that the replace destroys the seed filesystem Miao Xie
2014-07-24  3:37 ` [PATCH 02/10] Btrfs: don't write any data into a readonly device when scrub Miao Xie
2014-07-24 13:19   ` David Sterba
2014-07-25  9:39   ` Anand Jain
2014-07-24  3:37 ` [PATCH 03/10] Btrfs: fix wrong fsid check of scrub Miao Xie
2014-07-24 13:24   ` David Sterba
2014-09-03  6:58     ` [PATCH v2 " Miao Xie
2014-07-24  3:37 ` [PATCH 04/10] Btrfs: fix wrong generation check of super block on a seed device Miao Xie
2014-07-24 13:25   ` David Sterba
2014-07-24  3:37 ` [PATCH 05/10] Btrfs: make the device lock and its protected data in the same cacheline Miao Xie
2014-07-24  3:37 ` [PATCH 06/10] Btrfs: Fix the problem that the dirty flag of dev stats is cleared Miao Xie
2014-07-24 13:45   ` David Sterba
2014-09-03  6:59     ` [PATCH v2 " Miao Xie
2014-07-24  3:37 ` [PATCH 07/10] Btrfs: update the comment of total_bytes and disk_total_bytes of btrfs_devie Miao Xie
2014-07-24  3:37 ` [PATCH 08/10] Btrfs: Fix wrong device size when we are resizing the device Miao Xie
2014-07-24  3:37 ` [PATCH 09/10] Btrfs: don't consider the missing device when allocating new chunks Miao Xie
2014-07-24  3:37 ` [PATCH 10/10] Btrfs: cleanup unused latest_devid and latest_trans in fs_devices Miao Xie
2014-07-24 13:13 ` [PATCH 01/10] Btrfs: Fix the problem that the replace destroys the seed filesystem David Sterba
2014-07-25  7:56 ` Anand Jain [this message]
2014-07-25 12:33 ` [PATCH] btrfs: replace seed device followed by unmount causes kernel WARNING Anand Jain
2014-07-30  7:42   ` Miao Xie
2014-07-31  8:45     ` Anand Jain
2014-08-11  9:46       ` Anand Jain

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=53D20DBC.5030108@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=miaox@cn.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).