mirror of
https://github.com/systemd/systemd.git
synced 2024-10-30 06:25:37 +03:00
Merge pull request #22506 from poettering/devnum-zero-btrfs-block-dev
gpt-auto: some (primarily cosmetic) fixes to backing block device detection in gpt-auto-generator/sd-device
This commit is contained in:
commit
d74da762a3
@ -779,12 +779,16 @@ static int add_mounts(void) {
|
||||
return btrfs_log_dev_root(LOG_ERR, r, "root file system");
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to determine block device of root file system: %m");
|
||||
if (r == 0) { /* Not backed by block device */
|
||||
if (r == 0) { /* Not backed by a single block device. (Could be NFS or so, or could be multi-device RAID or so) */
|
||||
r = get_block_device_harder("/usr", &devno);
|
||||
if (r == -EUCLEAN)
|
||||
return btrfs_log_dev_root(LOG_ERR, r, "/usr");
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to determine block device of /usr file system: %m");
|
||||
return log_error_errno(r, "Failed to determine block device of /usr/ file system: %m");
|
||||
if (r == 0) { /* /usr/ not backed by single block device, either. */
|
||||
log_debug("Neither root nor /usr/ file system are on a (single) block device.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else if (r < 0)
|
||||
return log_error_errno(r, "Failed to read symlink /run/systemd/volatile-root: %m");
|
||||
|
@ -248,6 +248,10 @@ _public_ int sd_device_new_from_devnum(sd_device **ret, char type, dev_t devnum)
|
||||
assert_return(ret, -EINVAL);
|
||||
assert_return(IN_SET(type, 'b', 'c'), -EINVAL);
|
||||
|
||||
if (devnum == 0)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(ENODEV),
|
||||
"sd-device: Attempted to allocate device by zero major/minor, refusing.");
|
||||
|
||||
/* use /sys/dev/{block,char}/<maj>:<min> link */
|
||||
xsprintf(id, "%u:%u", major(devnum), minor(devnum));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user