Conversation
…nly fs=zfs bootfs.manifest.skel names /usr/lib/fs/libsolaris.so unconditionally, so the ZFS library is part of bootfs for every root filesystem. But bootfs_dep only listed it (and the tools that accompany it) as a prerequisite when fs=zfs, so a ZFS-enabled image with a different root filesystem had the file in its manifest without a rule ordering its build first. Serially that fails outright on the missing file; under -j it is a race that surfaces as an intermittent MKBOOTFS break on libsolaris.so or one of the userspace ZFS libraries. A conf_zfs=openzfs image with fs=ramfs and a ZFS pool created at runtime is a normal configuration and hits this every time, which is why such builds have needed the ZFS shared objects built by hand first. Key the dependency on the ZFS build (conf_zfs_openzfs) instead of on the root filesystem choice. fs=zfs and fs=ext keep their existing dependencies, and a build with no ZFS at all still adds nothing.
|
Closing this in favour of #1514, which fixes the same bug correctly. I tested this patch rather than reasoning about it, and it does not fix the failure it cites. The new branch is guarded by The underlying bug is real and slightly broader than described here: #1514 makes the prerequisite unconditional, which covers every Sorry for the noise of two PRs on one line of Makefile. Keeping the one that is correct. |
Summary
A ZFS-enabled build whose root filesystem is not
zfshas no rule ordering the ZFSlibrary and tools before MKBOOTFS runs, so the bootfs manifest can reference files
that have not been built yet.
bootfs_deplisted them only underfs=zfs:The case that matters in practice is
conf_zfs=openzfs fs=ramfswith a ZFS poolcreated at runtime, which is a normal configuration. For
fs=ramfs,scripts/build(line 224) setsmanifest=$OUT/usr.manifest, i.e. the bootfsmanifest IS
usr.manifestandbootfs.manifest.skelis not used at all. The ZFSmodule contributes
/usr/lib/fs/libsolaris.soto that manifest, so bootfs needslibsolaris.soand the userspace ZFS tools built first, yet nothing said so.Serially that fails outright on the missing file; under
-jit is a race thatsurfaces as an intermittent MKBOOTFS break on
libsolaris.soor one of theuserspace ZFS libraries. It is why building such an image has required building the
ZFS shared objects by hand first.
The change
Key the dependency on the ZFS build itself (
conf_zfs_openzfs) rather than on theroot filesystem choice.
Verified behaviour
Evaluating the conditional for each configuration, before and after:
conf_zfs=openzfs fs=ramfsconf_zfs=openzfs fs=zfsconf_zfs=openzfs fs=extfs=ramfsOnly the broken configuration changes;
fs=zfs,fs=extand non-ZFS builds keeptheir existing dependencies.
One file.
Note on a separate, independent bug
While validating this we found a second and distinct defect at the same site, which
this PR does not address: passing
open_zfsexplicitly in the image listshadows the
zfsplaceholder module.resolve.require()registersopen_zfs'sprovides=['zfs']under the namezfs, somodules/zfs/module.pyis neverimported and the
/usr/lib/fs/libsolaris.somanifest line it owns never reachesusr.manifestat all. Measured:zfs,zfs-toolsopen_zfs,zfs-toolsopen_zfs,zfs,zfs-toolsOn
fs=ramfsthat is fatal rather than a race: the guest dies at "Failed topreload ZFS library. Powering off." The same shadowing applies to
bsd_zfs. Thatdeserves its own fix in the module-resolution layer and is not in scope here.