summaryrefslogtreecommitdiff
path: root/src/sysext
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-11-30 17:17:20 +0100
committerDaan De Meyer <daan.j.demeyer@gmail.com>2022-12-01 11:32:30 +0100
commit73d88b806b92efa0738bb6bcccbf105441f6d8cb (patch)
tree95f3d63d9301ca7d79d6f319878fe05e7737bed1 /src/sysext
parent9fe26523a189435d75b9d745188e09c17928d89e (diff)
downloadsystemd-73d88b806b92efa0738bb6bcccbf105441f6d8cb.tar.gz
dissect: rework DISSECT_IMAGE_ADD_PARTITION_DEVICES + DISSECT_IMAGE_OPEN_PARTITION_DEVICES
Curently, these two flags were implied by dissect_loop_device(), but that's not right, because this means systemd-gpt-auto-generator will dissect the root block device with these flags set and that's not desirable: the generator should not cause the partition devices to be created (we don't intend to use them right-away after all, but expect udev to find/probe them first, and then mount them though .mount units). And there's no point in opening the partition devices, since we do not intend to mount them via fds either. Hence, rework this: instead of implying the flags, specify them explicitly. While we are at it, let's also rename the flags to make them more descriptive: DISSECT_IMAGE_MANAGE_PARTITION_DEVICES becomes DISSECT_IMAGE_ADD_PARTITION_DEVICES, since that's really all this does: add the partition devices via BLKPG. DISSECT_IMAGE_OPEN_PARTITION_DEVICES becomes DISSECT_IMAGE_PIN_PARTITION_DEVICES, since we not only open the devices, but keep the devices open continously (i.e. we "pin" them). Also, drop the DISSECT_IMAGE_BLOCK_DEVICE combination flag, since it is misleading, i.e. it suggests it was appropriate to specify on all dissected blocking devices, but that's precisely not the case, see the systemd-gpt-auto-generator case. My guess is that the confusion around this was actually the cause for this bug we are addressing here. Fixes: #25528
Diffstat (limited to 'src/sysext')
-rw-r--r--src/sysext/sysext.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/sysext/sysext.c b/src/sysext/sysext.c
index 9a7ef8eb29..b9147fbd78 100644
--- a/src/sysext/sysext.c
+++ b/src/sysext/sysext.c
@@ -522,7 +522,9 @@ static int merge_subprocess(Hashmap *images, const char *workspace) {
DISSECT_IMAGE_GENERIC_ROOT |
DISSECT_IMAGE_REQUIRE_ROOT |
DISSECT_IMAGE_MOUNT_ROOT_ONLY |
- DISSECT_IMAGE_USR_NO_ROOT;
+ DISSECT_IMAGE_USR_NO_ROOT |
+ DISSECT_IMAGE_ADD_PARTITION_DEVICES |
+ DISSECT_IMAGE_PIN_PARTITION_DEVICES;
r = verity_settings_load(&verity_settings, img->path, NULL, NULL);
if (r < 0)