]> asedeno.scripts.mit.edu Git - linux.git/commit
btrfs: Fix split-brain handling when changing FSID to metadata uuid
authorNikolay Borisov <nborisov@suse.com>
Fri, 10 Jan 2020 12:11:35 +0000 (14:11 +0200)
committerDavid Sterba <dsterba@suse.com>
Thu, 23 Jan 2020 16:24:39 +0000 (17:24 +0100)
commit1362089d2ad7e20d16371b39d3c11990d4ec23e4
treea58b77628f3c9449130401d024dc9272438f261e
parent05840710149c7d1a78ea85a2db5723f706e97d8f
btrfs: Fix split-brain handling when changing FSID to metadata uuid

Current code doesn't correctly handle the situation which arises when
a file system that has METADATA_UUID_INCOMPAT flag set and has its FSID
changed to the one in metadata uuid. This causes the incompat flag to
disappear.

In case of a power failure we could end up in a situation where part of
the disks in a multi-disk filesystem are correctly reverted to
METADATA_UUID_INCOMPAT flag unset state, while others have
METADATA_UUID_INCOMPAT set and CHANGING_FSID_V2_IN_PROGRESS.

This patch corrects the behavior required to handle the case where a
disk of the second type is scanned first, creating the necessary
btrfs_fs_devices. Subsequently, when a disk which has already completed
the transition is scanned it should overwrite the data in
btrfs_fs_devices.

Reported-by: Su Yue <Damenly_Su@gmx.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c