linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Mason <clm@fb.com>
To: Anand Jain <anand.jain@oracle.com>, <linux-btrfs@vger.kernel.org>
Cc: <dsterba@suse.cz>, <holger@applied-asynchrony.com>,
	<xiaolong.ye@intel.com>
Subject: Re: [PATCH v3 2/2] btrfs: make sure device is synced before return
Date: Thu, 23 Jun 2016 10:27:27 -0400	[thread overview]
Message-ID: <dd4d6f70-46bf-0ce9-31f8-bc337b67fb42@fb.com> (raw)
In-Reply-To: <1466686447-7780-1-git-send-email-anand.jain@oracle.com>



On 06/23/2016 08:54 AM, Anand Jain wrote:
> An inconsistent behavior due to stale reads from the
> disk was reported
>
>   mail-archive.com/linux-btrfs@vger.kernel.org/msg54188.html
>
> This patch will make sure devices are synced before
> return in the unmount thread.
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  v2: Also to make sure bdev_closing is set it needs rcu_barrier(),
>      restored rcu_barrier().
>  v3: Removed the complicated timed-wait on blkdev_put code,
>      but make synced and invalidated before umount is returned.
>      So sorry that I have to change the title of this patch
>      as well (was: btrfs: wait for bdev put).
>
>  fs/btrfs/volumes.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 604daf315669..f741ade130a4 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -870,6 +870,11 @@ static void btrfs_close_one_device(struct btrfs_device *device)
>  	if (device->missing)
>  		fs_devices->missing_devices--;
>
> +	if (device->bdev && device->writeable) {
> +		sync_blockdev(device->bdev);
> +		invalidate_bdev(device->bdev);
> +	}
> +
>  	new_device = btrfs_alloc_device(NULL, &device->devid,
>  					device->uuid);
>  	BUG_ON(IS_ERR(new_device)); /* -ENOMEM */
>

This should do it,I'll check with the xfstest I was able to reliably get 
errors on.

Thanks!

-chris

  reply	other threads:[~2016-06-23 14:27 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-26  9:27 [PULL] Btrfs for 4.7, part 2 David Sterba
2016-05-27  0:14 ` Chris Mason
2016-05-27 11:18   ` David Sterba
2016-05-27 14:35     ` Chris Mason
2016-05-27 15:42       ` Chris Mason
2016-05-28  5:14         ` Anand Jain
2016-05-29 12:21           ` Chris Mason
2016-06-14 10:52             ` Anand Jain
2016-06-14 10:55               ` [PATCH 1/2] btrfs: reorg btrfs_close_one_device() Anand Jain
2016-06-14 10:55                 ` [PATCH 2/2] btrfs: wait for bdev put Anand Jain
2016-06-18 16:34                   ` Holger Hoffstätte
2016-06-20  8:33                     ` Anand Jain
2016-06-21 10:24                   ` [PATCH v2 " Anand Jain
2016-06-21 11:46                     ` Holger Hoffstätte
2016-06-21 13:00                     ` Chris Mason
2016-06-22 10:18                       ` Anand Jain
2016-06-22 21:47                         ` Chris Mason
2016-06-23 13:07                           ` Anand Jain
2016-06-23 12:54                   ` [PATCH v3 2/2] btrfs: make sure device is synced before return Anand Jain
2016-06-23 14:27                     ` Chris Mason [this message]
2016-07-08 14:13                     ` David Sterba

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=dd4d6f70-46bf-0ce9-31f8-bc337b67fb42@fb.com \
    --to=clm@fb.com \
    --cc=anand.jain@oracle.com \
    --cc=dsterba@suse.cz \
    --cc=holger@applied-asynchrony.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=xiaolong.ye@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).