diff options
author | Anand Jain <anand.jain@oracle.com> | 2016-06-23 20:54:07 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-07-26 13:52:25 +0200 |
commit | e2bf6e89b4c71ea08223f13a700cfd0b576f7e7a (patch) | |
tree | 7a946060ffab144a79a884e1abceb51e84795180 /fs | |
parent | f448341af9cf50b9f405f5192f184d398e1812e0 (diff) | |
download | linux-e2bf6e89b4c71ea08223f13a700cfd0b576f7e7a.tar.bz2 |
btrfs: make sure device is synced before return
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>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/volumes.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index e54b3fe92e90..51bd3ee8e64f 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 */ |