Skip to content

zfs-mount-generator improvements (remove udev-settle dependency) RFC#18486

Draft
aerusso wants to merge 2 commits into
openzfs:masterfrom
aerusso:mrs/no-udev
Draft

zfs-mount-generator improvements (remove udev-settle dependency) RFC#18486
aerusso wants to merge 2 commits into
openzfs:masterfrom
aerusso:mrs/no-udev

Conversation

@aerusso
Copy link
Copy Markdown
Contributor

@aerusso aerusso commented May 2, 2026

Motivation and Context

Previously, the zfs-mount-generator produced .mount units that depended on the zfs-import.target. This meant that every filesystem required all pool imports be completed before beginning mounting. Additionally, the zfs-import*.service units that actually performed the zpool import depended on the deprecated systemd-udev-settle.service. This leads to warnings, and more fragile mount behavior.

See also #10891

Description

Instead, make the zfs-mount-generator .mount units depend on a per-pool zfs-import@.service template. Additionally, have zfs-mount-generator grant zfs-import@.service dependencies on the associated .devices required for the pool to actually import.

Additionally, remove udev settle dependencies in systemd units that depend on zfs-import targets. Also, remove the zfs-import.target wait for zfs-mount@.service, since not all pools need to be imported to begin mounting filesystems.

How Has This Been Tested?

I am running this, rebased onto 2.4.1. I am looking for more widespread testing here.

I suspect that this may break some configurations. We need to talk about this.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Quality assurance (non-breaking change which makes the code more robust against bugs)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

aerusso added 2 commits May 3, 2026 00:47
Previously, the zfs-mount-generator produced .mount units that depended
on the zfs-import.target.  This meant that every filesystem required all
pool imports be completed before beginning mounting.  Additionally, the
zfs-import*.service units that actually performed the `zpool import`
depended on the deprecated systemd-udev-settle.service.  This leads to
warnings, and more fragile mount behavior.

Instead, make the zfs-mount-generator .mount units depend on a per-pool
zfs-import@.service template.  Additionally, have zfs-mount-generator
grant zfs-import@.service dependencies on the associated `.device`s
required for the pool to actually import.

Signed-off-by: Antonio Enrico Russo <aerusso@aerusso.net>
Remove udev settle dependencies in systemd units that depend on
zfs-import targets.  Also, remove the zfs-import.target wait for
zfs-mount@.service, since not all pools need to be imported to begin
mounting filesystems.

Signed-off-by: Antonio Enrico Russo <aerusso@aerusso.net>
@aerusso aerusso marked this pull request as draft May 3, 2026 15:26
@github-actions github-actions Bot added the Status: Work in Progress Not yet ready for general review label May 3, 2026
@aerusso
Copy link
Copy Markdown
Contributor Author

aerusso commented May 3, 2026

Yikes, the OOM logic is nasty (and there are memory leaks). I need to work through that before this is worth a close review. The other logic is still worth looking at, though.

@behlendorf behlendorf self-requested a review May 7, 2026 18:33
@behlendorf
Copy link
Copy Markdown
Contributor

Thanks @aerusso for tackling this work. I think this makes a lot of sense and is the way we need to go, just a couple questions.

dependencies on the associated .devices required for the pool to actually import.

Could you elaborate a bit on how systemd handles this when there are multiple devices listed. When is the zfs-import@.service started? From the documentation it sounds like this occurs once after all of the listed *.device dependencies are started for the first time. And since you've used Wants instead of Requires they don't all need to succeed, which is good.

But what happens if one of the expected *.device files never gets dynamically created. For example, because the device has failed or was removed from the system? In this case, will the zfs-import@.service ever be started? If that's the case, it seems like we still want some kind of timeout which triggers the import so pools with sufficient redundancy are imported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Work in Progress Not yet ready for general review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants