linux-IllusionX/fs/btrfs
Nikolay Borisov 7a62d0f073 btrfs: Handle one more split-brain scenario during fsid change
This commit continues hardening the scanning code to handle cases where
power loss could have caused disks in a multi-disk filesystem to be
in inconsistent state. Namely handle the situation that can occur when
some of the disks in multi-disk fs have completed their fsid change i.e
they have METADATA_UUID incompat flag set, have cleared the
CHANGING_FSID_V2 flag and their fsid/metadata_uuid are different. At
the same time the other half of the disks will have their
fsid/metadata_uuid unchanged and will only have CHANGING_FSID_V2 flag.

This is handled by introducing code in the scan path which:

 a) Handles the case when a device with CHANGING_FSID_V2 flag is
 scanned and as a result btrfs_fs_devices is created with matching
 fsid/metdata_uuid. Subsequently, when a device with completed fsid
 change is scanned it will detect this via the new code in find_fsid
 i.e that such an fs_devices exist that fsid_change flag is set to true,
 it's metadata_uuid/fsid match and the metadata_uuid of the scanned
 device matches that of the fs_devices. In this case, it's important to
 note that the devices which has its fsid change completed will have a
 higher generation number than the device with FSID_CHANGING_V2 flag
 set, so its superblock block will be used during mount. To prevent an
 assertion triggering because the sb used for mounting will have
 differing fsid/metadata_uuid than the ones in the fs_devices struct
 also add code in device_list_add which overwrites the values in
 fs_devices.

 b) Alternatively we can end up with a device that completed its
 fsid change be scanned first which will create the respective
 btrfs_fs_devices struct with differing fsid/metadata_uuid. In this
 case when a device with FSID_CHANGING_V2 flag set is scanned it will
 call the newly added find_fsid_inprogress function which will return
 the correct fs_devices.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2018-12-17 14:51:38 +01:00
..
tests btrfs: use EXPORT_FOR_TESTS for conditionally exported functions 2018-12-17 14:51:37 +01:00
acl.c
async-thread.c
async-thread.h
backref.c btrfs: Remove needless tree locking in iterate_inode_extrefs 2018-12-17 14:51:30 +01:00
backref.h
btrfs_inode.h btrfs: use tagged writepage to mitigate livelock of snapshot 2018-12-17 14:51:33 +01:00
check-integrity.c btrfs: Remove fsid/metadata_fsid fields from btrfs_info 2018-12-17 14:51:37 +01:00
check-integrity.h
compression.c btrfs: Remove unused extent_state argument from btrfs_writepage_endio_finish_ordered 2018-12-17 14:51:32 +01:00
compression.h
ctree.c btrfs: Remove fsid/metadata_fsid fields from btrfs_info 2018-12-17 14:51:37 +01:00
ctree.h btrfs: Remove fsid/metadata_fsid fields from btrfs_info 2018-12-17 14:51:37 +01:00
dedupe.h
delayed-inode.c Btrfs: kill btrfs_clear_path_blocking 2018-10-15 17:23:38 +02:00
delayed-inode.h Btrfs: delayed-inode: use rb_first_cached for ins_root and del_root 2018-10-15 17:23:33 +02:00
delayed-ref.c btrfs: delayed-ref: extract find_first_ref_head from find_ref_head 2018-10-17 19:21:00 +02:00
delayed-ref.h btrfs: delayed-ref: pass delayed_refs directly to btrfs_delayed_ref_lock 2018-10-15 17:23:41 +02:00
dev-replace.c btrfs: don't report user-requested cancel as an error 2018-12-17 14:51:36 +01:00
dev-replace.h btrfs: mark btrfs_dev_replace_start as static 2018-12-17 14:51:34 +01:00
dir-item.c btrfs: Remove root parameter from btrfs_insert_dir_item 2018-10-15 17:23:25 +02:00
disk-io.c btrfs: Add handling for disk split-brain scenario during fsid change 2018-12-17 14:51:38 +01:00
disk-io.h btrfs: unify end_io callbacks of async_submit_bio 2018-08-06 13:12:55 +02:00
export.c btrfs: Remove 'objectid' member from struct btrfs_root 2018-10-15 17:23:25 +02:00
export.h
extent-tree.c btrfs: Remove fsid/metadata_fsid fields from btrfs_info 2018-12-17 14:51:37 +01:00
extent_io.c btrfs: use EXPORT_FOR_TESTS for conditionally exported functions 2018-12-17 14:51:37 +01:00
extent_io.h btrfs: use EXPORT_FOR_TESTS for conditionally exported functions 2018-12-17 14:51:37 +01:00
extent_map.c Btrfs: extent_map: use rb_first_cached 2018-10-15 17:23:33 +02:00
extent_map.h Btrfs: extent_map: use rb_first_cached 2018-10-15 17:23:33 +02:00
file-item.c
file.c Btrfs: remove no longer used io_err from btrfs_log_ctx 2018-12-17 14:51:31 +01:00
free-space-cache.c Btrfs: fix deadlock on tree root leaf when finding free extent 2018-11-06 16:42:32 +01:00
free-space-cache.h
free-space-tree.c btrfs: use EXPORT_FOR_TESTS for conditionally exported functions 2018-12-17 14:51:37 +01:00
free-space-tree.h
inode-item.c
inode-map.c
inode-map.h
inode.c btrfs: remove unused drop_on_err in btrfs_mkdir 2018-12-17 14:51:36 +01:00
ioctl.c btrfs: Remove fsid/metadata_fsid fields from btrfs_info 2018-12-17 14:51:37 +01:00
Kconfig
locking.c
locking.h
lzo.c
Makefile
math.h
ordered-data.c Btrfs: remove no longer used stuff for tracking pending ordered extents 2018-12-17 14:51:25 +01:00
ordered-data.h Btrfs: remove no longer used stuff for tracking pending ordered extents 2018-12-17 14:51:25 +01:00
orphan.c
print-tree.c
print-tree.h
props.c
props.h
qgroup.c btrfs: Remove unnecessary tree locking code in qgroup_rescan_leaf 2018-12-17 14:51:31 +01:00
qgroup.h btrfs: qgroup: Avoid calling qgroup functions if qgroup is not enabled 2018-10-15 17:23:40 +02:00
raid56.c
raid56.h
rcu-string.h
reada.c
ref-verify.c btrfs: Remove 'objectid' member from struct btrfs_root 2018-10-15 17:23:25 +02:00
ref-verify.h
relocation.c Btrfs: prevent ioctls from interfering with a swap file 2018-12-17 14:51:29 +01:00
root-tree.c btrfs: Remove fs_info from btrfs_add_root_ref 2018-08-06 13:13:00 +02:00
scrub.c btrfs: open code btrfs_dev_replace_stats_inc 2018-10-15 17:23:37 +02:00
send.c Btrfs: send, fix infinite loop due to directory rename dependencies 2018-11-21 17:03:50 +01:00
send.h
struct-funcs.c
super.c btrfs: Remove fsid/metadata_fsid fields from btrfs_info 2018-12-17 14:51:37 +01:00
sysfs.c btrfs: Add sysfs support for metadata_uuid feature 2018-12-17 14:51:37 +01:00
sysfs.h
transaction.c Btrfs: remove no longer used stuff for tracking pending ordered extents 2018-12-17 14:51:25 +01:00
transaction.h Btrfs: remove no longer used stuff for tracking pending ordered extents 2018-12-17 14:51:25 +01:00
tree-checker.c btrfs: tree-checker: Don't check max block group size as current max chunk size limit is unreliable 2018-12-04 15:05:30 +01:00
tree-checker.h
tree-defrag.c
tree-log.c Btrfs: simpler and more efficient cleanup of a log tree's extent io tree 2018-12-17 14:51:31 +01:00
tree-log.h Btrfs: remove no longer used io_err from btrfs_log_ctx 2018-12-17 14:51:31 +01:00
ulist.c
ulist.h
uuid-tree.c
volumes.c btrfs: Handle one more split-brain scenario during fsid change 2018-12-17 14:51:38 +01:00
volumes.h btrfs: add members to fs_devices to track fsid changes 2018-12-17 14:51:38 +01:00
xattr.c
xattr.h
zlib.c
zstd.c