Description
System information
Type | Version/Name |
---|---|
Distribution Name | Fedora Linux |
Distribution Version | 41 (Server Edition) |
Kernel Version | 6.11.4-301.fc41.x86_64 |
Architecture | x86_64 |
OpenZFS Version | zfs-2.3.99-175_g390f6c119, zfs-kmod-2.3.99-175_g390f6c119 |
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. In zfs_setup_direct()
, the conditions here do not account for direct=standard
and ioflag & 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:
truncate -s 64M /tmp/f1
zpool create tank /tmp/f1 -O mountpoint=/root/custom_extensions
mkdir -p /root/custom_extensions/myext/usr/local/bin
echo -e '#!/bin/bash\nexec /usr/bin/echo "Hello World"' > /root/custom_extensions/myext/usr/local/bin/hello
chmod 755 /root/custom_extensions/myext/usr/local/bin/hello
mkdir -p /root/custom_extensions/myext/usr/lib/extension-release.d
echo -e "ID=_any\n" > /root/custom_extensions/myext/usr/lib/extension-release.d/extension-release.hello
mksquashfs /root/custom_extensions/myext /root/custom_extensions/hello.raw
mkdir -p /run/extensions
ln -s /root/custom_extensions/hello.raw /run/extensions/
systemd-sysext refresh
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
[ 1073.145411] loop0: detected capacity change from 0 to 8
[ 1073.159480] invalid error, dev loop0, sector 0 op 0x0:(READ) flags 0x800 phys_seg 1 prio class 0
[ 1073.171444] SQUASHFS error: Failed to read block 0x0: -22
[ 1073.174262] unable to read squashfs_super_block