repart: canonicalize node in varlink Run method
Run acquire_root_devno() on the varlink-provided node so symlinks (e.g. /dev/disk/by-id/...) resolve to their canonical /dev/ path before being used. Without this, sym_fdisk_partname() produces a "-partN" symlink that udev hasn't created yet when repart calls open() on it right after BLKPG_ADD_PARTITION, failing with ENOENT. This also brings the varlink path in line with the CLI path's partition-to-whole-disk and dm-crypt-to-backing resolution.
This commit is contained in:
committed by
Daan De Meyer
parent
8b518c67fe
commit
c61a9a6dba
+4
-2
@@ -10964,7 +10964,7 @@ static int find_root(Context *context) {
|
||||
} else if (r < 0)
|
||||
return log_error_errno(r, "Failed to read symlink /run/systemd/volatile-root: %m");
|
||||
else {
|
||||
r = acquire_root_devno(device, NULL, open_flags, &context->node, &context->backing_fd);
|
||||
r = acquire_root_devno(device, /* root= */ NULL, open_flags, &context->node, &context->backing_fd);
|
||||
if (r == -EUCLEAN)
|
||||
return btrfs_log_dev_root(LOG_ERR, r, device);
|
||||
if (r < 0)
|
||||
@@ -11389,7 +11389,9 @@ static int vl_method_run(
|
||||
return r;
|
||||
|
||||
if (p.node) {
|
||||
context->node = TAKE_PTR(p.node);
|
||||
r = acquire_root_devno(p.node, NULL, O_CLOEXEC|context_open_mode(context), &context->node, &context->backing_fd);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to open file or determine backing device of %s: %m", p.node);
|
||||
|
||||
r = context_load_partition_table(context);
|
||||
if (r == -EHWPOISON)
|
||||
|
||||
Reference in New Issue
Block a user