summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2017-11-15 16:28:11 -0700
committerDavid Sterba <dsterba@suse.com>2018-01-22 16:08:20 +0100
commita6f93c71d412ba8ed743152c3a54ad0b78dcd9c7 (patch)
tree29bcedd6216570a3f34d63dff6e93eee99a63b30 /fs/btrfs/disk-io.c
parent81fdf6382b3b92f6fc5f34f9c8cd9074b25f6c0e (diff)
downloadop-kernel-dev-a6f93c71d412ba8ed743152c3a54ad0b78dcd9c7.zip
op-kernel-dev-a6f93c71d412ba8ed743152c3a54ad0b78dcd9c7.tar.gz
Btrfs: avoid losing data raid profile when deleting a device
We've avoided data losing raid profile when doing balance, but it turns out that deleting a device could also result in the same problem. Say we have 3 disks, and they're created with '-d raid1' profile. - We have chunk P (the only data chunk on the empty btrfs). - Suppose that chunk P's two raid1 copies reside in disk A and disk B. - Now, 'btrfs device remove disk B' btrfs_rm_device() -> btrfs_shrink_device() -> btrfs_relocate_chunk() #relocate any chunk on disk B to other places. - Chunk P will be removed and a new chunk will be created to hold those data, but as chunk P is the only one holding raid1 profile, after it goes away, the new chunk will be created as single profile which is our default profile. This fixes the problem by creating an empty data chunk before relocating the data chunk. Metadata/System chunk are supposed to have non-zero bytes all the time so their raid profile is preserved. Reported-by: James Alandt <James.Alandt@wdc.com> Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud