btrfs-progs/common
Nikolay Borisov 681b4bd5e1 btrfs-progs: ignore devices representing paths in multipath
Currently btrfs-progs will happily enumerate any device which has a
btrfs filesystem on it irrespective of its type. For the majority of
use cases that's fine and there haven't been any problems with that.
However, there was a recent report that in multipath scenario when
running "btrfs fi show" after a path flap (path going down and then
coming back up) instead of the multipath device being show the device
which represents the flapped path is shown. So a multipath filesystem
might look like:

  Label: none  uuid: d3c1261f-18be-4015-9fef-6b35759dfdba
	  Total devices 1 FS bytes used 192.00KiB
	  devid    1 size 10.00GiB used 536.00MiB path /dev/mapper/3600140501cc1f49e5364f0093869c763

/dev/mapper/xxx is actually backed by an arbitrary number of paths,
which in turn are presented to the system as ordinary SCSI devices i.e
/dev/sdX. If a path flaps and a user re-runs 'btrfs fi show' the output
would look like:

  Label: none  uuid: d3c1261f-18be-4015-9fef-6b35759dfdba
	  Total devices 1 FS bytes used 192.00KiB
	  devid    1 size 10.00GiB used 536.00MiB path /dev/sdd

This only occurs on unmounted filesystems as those are enumerated by
btrfs-progs, for mounted filesystem the kernel properly deals only with
the actual multipath device.

Turns out the output of this command is consumed by libraries and the
presence of a path device rather than the actual multipath causes
issues.

Fix this by checking for the presence of DM_MULTIPATH_DEVICE_PATH
udev attribute as multipath path devices are tagged with this attribute
by the multipath udev scripts.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2021-10-06 16:50:35 +02:00
..
box.h btrfs-progs: build most common tools into one binary (busybox style) 2019-07-04 15:30:40 +02:00
defs.h btrfs-progs: move common-defs to common/ 2020-03-31 18:37:35 +02:00
device-scan.c btrfs-progs: ignore devices representing paths in multipath 2021-10-06 16:50:35 +02:00
device-scan.h btrfs-progs: unify GPL header comments 2021-09-07 13:58:44 +02:00
device-utils.c btrfs-progs: do sysfs detection of device discard capability 2021-10-06 16:49:30 +02:00
device-utils.h btrfs-progs: add helper to read zone size from sysfs 2021-07-02 17:27:53 +02:00
extent-cache.c btrfs-progs: unify GPL header comments 2021-09-07 13:58:44 +02:00
extent-cache.h btrfs-progs: move extent-cache.c to common/ 2020-08-31 17:01:04 +02:00
format-output.c btrfs-progs: split unit related helpers from utils.c 2021-05-06 16:41:47 +02:00
format-output.h btrfs-progs: lots of typo fixes (codespell) 2020-03-31 18:37:38 +02:00
fsfeatures.c btrfs-progs: move btrfs_tree_search2_ioctl_supported to fsfeatures.c 2021-09-07 16:20:17 +02:00
fsfeatures.h btrfs-progs: move btrfs_tree_search2_ioctl_supported to fsfeatures.c 2021-09-07 16:20:17 +02:00
help.c btrfs-progs: split global help HELPINFO_INSERT_GLOBALS 2020-06-12 19:30:36 +02:00
help.h btrfs-progs: add global verbose and quiet options and helper functions 2020-06-12 19:30:43 +02:00
internal.h btrfs-progs: move internal.h to common/ 2019-07-03 20:49:03 +02:00
messages.c btrfs-progs: add global verbose and quiet options and helper functions 2020-06-12 19:30:43 +02:00
messages.h btrfs-progs: add separate verbosity level for on-by-default messages 2020-06-12 19:32:29 +02:00
open-utils.c btrfs-progs: split open/close helpers from utils.c 2021-05-06 16:41:47 +02:00
open-utils.h btrfs-progs: split open/close helpers from utils.c 2021-05-06 16:41:47 +02:00
parse-utils.c btrfs-progs: move parse_qgroupid to parse utils 2021-09-07 14:20:42 +02:00
parse-utils.h btrfs-progs: move parse_qgroupid to parse utils 2021-09-07 14:20:42 +02:00
path-utils.c btrfs-progs: receive: fix btrfs_mount_root substring bug 2021-02-19 16:29:40 +01:00
path-utils.h btrfs-progs: remove unnecessary linux/*.h includes 2021-05-06 16:41:47 +02:00
rbtree-utils.c btrfs-progs: move rbtree-utils.[ch] to common/ 2019-07-03 20:49:04 +02:00
rbtree-utils.h btrfs-progs: move rbtree-utils.[ch] to common/ 2019-07-03 20:49:04 +02:00
repair.c btrfs-progs: move repair.[ch] to common/ 2021-05-06 16:41:47 +02:00
repair.h btrfs-progs: move repair.[ch] to common/ 2021-05-06 16:41:47 +02:00
send-stream.c btrfs-progs: move send.h to kernel-shared/ 2021-09-07 19:26:46 +02:00
send-stream.h btrfs-progs: move send-stream.c to common/ 2020-08-31 17:01:04 +02:00
send-utils.c btrfs-progs: open code btrfs_list_get_path_rootid 2021-09-08 16:35:47 +02:00
send-utils.h btrfs-progs: move ctree.c to kernel-shared/ 2020-08-31 17:01:05 +02:00
string-table.c btrfs-progs: move string-table.[ch] to common/ 2019-07-03 20:49:03 +02:00
string-table.h btrfs-progs: move string-table.[ch] to common/ 2019-07-03 20:49:03 +02:00
task-utils.c btrfs-progs: move task-utils.[ch] to common/ 2019-07-03 20:49:03 +02:00
task-utils.h btrfs-progs: move task-utils.[ch] to common/ 2019-07-03 20:49:03 +02:00
units.c btrfs-progs: split unit related helpers from utils.c 2021-05-06 16:41:47 +02:00
units.h btrfs-progs: split unit related helpers from utils.c 2021-05-06 16:41:47 +02:00
utils-lib.c btrfs-progs: unify GPL header comments 2021-09-07 13:58:44 +02:00
utils.c btrfs-progs: rename and move group_profile_max_safe_loss 2021-09-07 16:38:56 +02:00
utils.h btrfs-progs: rename and move group_profile_max_safe_loss 2021-09-07 16:38:56 +02:00