-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
systemd-sysext fails to install extensions with Direct I/O #17027
Comments
From the Direct IO PR:
This seems to be expected behavior based on the reasoning below (from the same PR). It seems solving this would require adding an additional option to the directio property.
See also #16972 for a possible solution for applications using statx. |
I totally agree. systemd does indeed try to open the loop device with the O_DIRECT flag. However, since we have no control over |
Looking at https://github.com/systemd/systemd/blob/v257.2/src/shared/loop-util.c#L614, I wonder if this could be resolved by setting the environment variable SYSTEMD_LOOP_DIRECT_IO to off. loop_configure_verify_direct_io is also of interest along with https://github.com/truenas/linux/blob/truenas/linux-6.12/drivers/block/loop.c#L169. It seems like there is logic to enforce a logical block size of the loopback device based on the logical block size of backing device, but this presumably isn't getting applied for some reason. |
Setting
It appears that |
Stupid question from a person who failed to follow the details of the discussion, does the mentioned statx patch happens to fix the problem? From quick look at systemd sources it looks like alignment will be based on sector size. Also for zvol and loopback device backed by zfs file it seems logical sector size is 512b according to fdisk (in my case pool ashift=12, recordsize/volblocksize >= 16k). |
System information
Describe the problem you're observing
Squashfs uses a loop device to read data via its AIO handler, which sets the
O_DIRECT
flag on the request. Inzfs_setup_direct()
, the conditions here do not account fordirect=standard
andioflag & O_DIRECT
. This causes most of the requests to fail due to unalignment with the page boundary.While the Linux block layer typically rejects requests that are not aligned to the block device's logical block size, the loop device bypasses the block layer by directly invoking the file system's read/write handler without enforcing alignment checks. As a result,
systemd-sysext
fails reliably when attempting to install extensions on a ZFS file system.Describe how to reproduce the problem
The following script reliably reproduces the issue by attempting to install a simple Hello World extension on a ZFS file system:
Expected Result:
The extension should install successfully, and the
systemd-sysext refresh
command should complete without errors.Actual Result:
systemd-sysext refresh
fails with error:Failed to read metadata for image hello: Invalid argument
.Include any warning/errors/backtraces from the system logs
The text was updated successfully, but these errors were encountered: