summaryrefslogtreecommitdiff
path: root/src/partition/growfs.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-09-07 18:50:41 +0200
committerLennart Poettering <lennart@poettering.net>2020-09-08 18:10:26 +0200
commit67f0ac8c79bb08451a70ee314daf06ee081ef24d (patch)
tree9b28afb41391a09a3ba94b2302fdbbf98b3d115b /src/partition/growfs.c
parentfc706b4816f75c01bd78bd5936e5f8740405093a (diff)
downloadsystemd-67f0ac8c79bb08451a70ee314daf06ee081ef24d.tar.gz
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
Diffstat (limited to 'src/partition/growfs.c')
-rw-r--r--src/partition/growfs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/partition/growfs.c b/src/partition/growfs.c
index c097963e0c..8c1a84d981 100644
--- a/src/partition/growfs.c
+++ b/src/partition/growfs.c
@@ -11,6 +11,7 @@
#include <sys/vfs.h>
#include "blockdev-util.h"
+#include "btrfs-util.h"
#include "cryptsetup-util.h"
#include "device-nodes.h"
#include "dissect-image.h"
@@ -212,6 +213,8 @@ static int run(int argc, char *argv[]) {
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "\"%s\" is not a mount point: %m", arg_target);
r = get_block_device(arg_target, &devno);
+ if (r == -EUCLEAN)
+ return btrfs_log_dev_root(LOG_ERR, r, arg_target);
if (r < 0)
return log_error_errno(r, "Failed to determine block device of \"%s\": %m", arg_target);