core: deduplicate identical dm-verity ExtensionImages=
It turns out OverlayFS doesn't handle gracefully when the same source is specified multiple times in lowerdir= and it fails with ELOOP: Failed to mount overlay (type overlay) on /run/systemd/mount-rootfs/opt (MS_RDONLY "lowerdir=/run/systemd/unit-extensions/1/opt:/run/systemd/unit-extensions/0/opt:/run/systemd/mount-rootfs/opt"): Too many levels of symbolic links This happens even if we mount each image in a different internal mount path, as OverlayFS will resolve it and look for the backing device, which will be the same device mapper entity, and return a hard error. This error does not appear if dm-verity is not used, so it is very confusing for users, and unnecessary. When mounting ExtensionImages, check if an image is dm-veritied, and drop duplicates if the root hashes match, to avoid this user-unfriendly hard error.
This commit is contained in:
@@ -941,6 +941,7 @@ static int mount_in_namespace_legacy(
|
||||
/* required_host_os_release_sysext_level= */ NULL,
|
||||
/* required_host_os_release_confext_level= */ NULL,
|
||||
/* required_sysext_scope= */ NULL,
|
||||
/* verity= */ NULL,
|
||||
/* ret_image= */ NULL);
|
||||
else
|
||||
r = mount_follow_verbose(LOG_DEBUG, FORMAT_PROC_FD_PATH(chased_src_fd), mount_tmp, NULL, MS_BIND, NULL);
|
||||
@@ -1166,6 +1167,7 @@ static int mount_in_namespace(
|
||||
/* required_host_os_release_sysext_level= */ NULL,
|
||||
/* required_host_os_release_confext_level= */ NULL,
|
||||
/* required_sysext_scope= */ NULL,
|
||||
/* verity= */ NULL,
|
||||
&img);
|
||||
if (r < 0)
|
||||
return log_debug_errno(
|
||||
|
||||
Reference in New Issue
Block a user