Merge pull request #16973 from poettering/btrfs-dev-root
print friendly error message if btrfs tells us /dev/root was backing block device of root fs
This commit is contained in:
@@ -315,6 +315,15 @@ int btrfs_get_block_device_fd(int fd, dev_t *dev) {
|
||||
return -errno;
|
||||
}
|
||||
|
||||
/* For the root fs — when no initrd is involved — btrfs returns /dev/root on any kernels from
|
||||
* the past few years. That sucks, as we have no API to determine the actual root then. let's
|
||||
* return an recognizable error for this case, so that the caller can maybe print a nice
|
||||
* message about this.
|
||||
*
|
||||
* https://bugzilla.kernel.org/show_bug.cgi?id=89721 */
|
||||
if (path_equal((char*) di.path, "/dev/root"))
|
||||
return -EUCLEAN;
|
||||
|
||||
if (stat((char*) di.path, &st) < 0)
|
||||
return -errno;
|
||||
|
||||
|
||||
@@ -121,3 +121,9 @@ int btrfs_qgroup_find_parents(int fd, uint64_t qgroupid, uint64_t **ret);
|
||||
|
||||
int btrfs_qgroup_get_quota_fd(int fd, uint64_t qgroupid, BtrfsQuotaInfo *quota);
|
||||
int btrfs_qgroup_get_quota(const char *path, uint64_t qgroupid, BtrfsQuotaInfo *quota);
|
||||
|
||||
static inline int btrfs_log_dev_root(int level, int ret, const char *p) {
|
||||
return log_full_errno(level, ret,
|
||||
"File system behind %s is reported by btrfs to be backed by pseudo-device /dev/root, which is not a valid userspace accessible device node. "
|
||||
"Cannot determine correct backing block device.", p);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ int quotactl_path(int cmd, const char *path, int id, void *addr) {
|
||||
r = get_block_device(path, &devno);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (devno == 0)
|
||||
if (devno == 0) /* Doesn't have a block device */
|
||||
return -ENODEV;
|
||||
|
||||
return quotactl_devno(cmd, devno, id, addr);
|
||||
|
||||
Reference in New Issue
Block a user