btrfs: if BTRFS_IOC_DEV_INFO returns /dev/root generate a friendly error message
authorLennart Poettering <lennart@poettering.net>
Mon, 7 Sep 2020 16:50:41 +0000 (18:50 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 8 Sep 2020 16:10:26 +0000 (18:10 +0200)
commit67f0ac8c79bb08451a70ee314daf06ee081ef24d
tree9b28afb41391a09a3ba94b2302fdbbf98b3d115b
parentfc706b4816f75c01bd78bd5936e5f8740405093a
btrfs: if BTRFS_IOC_DEV_INFO returns /dev/root generate a friendly error message

On systems that boot without initrd on a btrfs root file systems the
BTRFS_IOC_DEV_INFO ioctl returns /dev/root as backing device. That
sucks, since that is not a real device visible to userspace.

Since this has been that way since forever, and it doesn't look like the
kernel will get fixed soon for this, let's at least generate a useful
error message in this case.

This is not a bug fix, just a tweak to make this more recognizable.

Once the kernel gets fixed to report the correct device nodes in this
case, in a way userspace can make sense of them things will magically
work for systemd, too.

(Note that this doesn't add a log message about this to really all cases
we call get_device() in, but just the main ones that are called in early
boot context, after all all there's no benefit in seeing this message
too many times.)

https://github.com/systemd/systemd/issues/16953
https://bugs.freedesktop.org/show_bug.cgi?id=84689
https://bugzilla.kernel.org/show_bug.cgi?id=89721
src/basic/btrfs-util.c
src/basic/btrfs-util.h
src/gpt-auto-generator/gpt-auto-generator.c
src/partition/growfs.c
src/partition/repart.c