From: Anand Jain <Anand.Jain@oracle.com>
To: Miao Xie <miaox@cn.fujitsu.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 02/10] Btrfs: don't write any data into a readonly device when scrub
Date: Fri, 25 Jul 2014 17:39:25 +0800 [thread overview]
Message-ID: <53D225CD.5020603@oracle.com> (raw)
In-Reply-To: <1406173035-29478-2-git-send-email-miaox@cn.fujitsu.com>
On 07/24/2014 11:37 AM, Miao Xie wrote:
> We should not write data into a readonly device especially seed device when
> doing scrub, skip those devices.
Reviewed-by: Anand Jain <anand.jain@oracle.com>
> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
> ---
> fs/btrfs/scrub.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index b6d198f..23d3f6e 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -2904,6 +2904,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
> struct scrub_ctx *sctx;
> int ret;
> struct btrfs_device *dev;
> + struct rcu_string *name;
>
> if (btrfs_fs_closing(fs_info))
> return -EINVAL;
> @@ -2965,6 +2966,16 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
> return -ENODEV;
> }
>
> + if (!is_dev_replace && !readonly && !dev->writeable) {
just reading the commit message would ask question what
about readonly scrub anyway. Nice readonly scrub case
is taken care as well.
> + mutex_unlock(&fs_info->fs_devices->device_list_mutex);
> + rcu_read_lock();
> + name = rcu_dereference(dev->name);
> + btrfs_err(fs_info, "scrub: device %s is not writable",
> + name->str);
> + rcu_read_unlock();
> + return -EROFS;
> + }
> +
> mutex_lock(&fs_info->scrub_lock);
> if (!dev->in_fs_metadata || dev->is_tgtdev_for_dev_replace) {
> mutex_unlock(&fs_info->scrub_lock);
>
next prev parent reply other threads:[~2014-07-25 9:35 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 [this message]
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
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=53D225CD.5020603@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 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.