diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-09-29 11:19:10 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-29 11:19:10 -0400 |
commit | 8c8bee1d7ca47fc75b6bd24a8085c525a2394c02 (patch) | |
tree | eb10010a7baa7ab73b068f9d9a95d15b7d79e300 /fs/btrfs/volumes.c | |
parent | 1a40e23b95da45051ee4d74374c58ae87a14051c (diff) | |
download | linux-stable-8c8bee1d7ca47fc75b6bd24a8085c525a2394c02.tar.gz linux-stable-8c8bee1d7ca47fc75b6bd24a8085c525a2394c02.tar.bz2 linux-stable-8c8bee1d7ca47fc75b6bd24a8085c525a2394c02.zip |
Btrfs: Wait for IO on the block device inodes of newly added devices
btrfs-vol -a /dev/xxx will zero the first and last two MB of the device.
The kernel code needs to wait for this IO to finish before it adds
the device.
btrfs metadata IO does not happen through the block device inode. A
separate address space is used, allowing the zero filled buffer heads in
the block device inode to be written to disk after FS metadata starts
going down to the disk via the btrfs metadata inode.
The end result is zero filled metadata blocks after adding new devices
into the filesystem.
The fix is a simple filemap_write_and_wait on the block device inode
before actually inserting it into the pool of available devices.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 51f113119b25..f63cf7621a01 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1038,6 +1038,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) return -EIO; } + filemap_write_and_wait(bdev->bd_inode->i_mapping); mutex_lock(&root->fs_info->volume_mutex); trans = btrfs_start_transaction(root, 1); |