push
github
loop-util: shortcut block device fd when it carries no partition table 663f0bf5cb stopped reusing the original block device fd whenever partition scanning was requested (LO_FLAGS_PARTSCAN) but couldn't be enabled on the device, so that nested partition tables on devices the kernel won't scan (e.g. the pmOS/android case) get exposed via a real loop device. However that also forced a pointless loop device for any partition that carries a file system directly, e.g. a btrfs subvolume mounted via MountImages=. For multi-device btrfs this is fatal: the kernel rejects seeing the same member via both the original partition and the loop device, and the mount fails. A loop device is only ever needed here to expose a nested partition table. So only refuse the shortcut when the device actually carries one, probed via gpt_probe(), instead of whenever partition scanning is disabled. Devices carrying a file system directly (or nothing) take the shortcut as before. Add an integration test to cover the failure scenario of the original issue. Fixes: https://github.com/systemd/systemd/issues/42520 Replaces: https://github.com/systemd/systemd/pull/42576 Follow-up for 663f0bf5c Co-Authored-By: Luca Boccassi <luca.boccassi@gmail.com> Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
79 of 128 new or added lines in 4 files covered. (61.72%)
1429 existing lines in 45 files now uncovered.337157 of 462659 relevant lines covered (72.87%)
1301936.47 hits per line