Skip to content
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

dracut: Fix race condition between load-key and import #11500

Merged
merged 1 commit into from
Jan 26, 2021

Conversation

lhuedepohl
Copy link
Contributor

Motivation

Another dracut issue that surfaces for me on openSUSE. With this commit (and the recently merged #11487) I can boot from an encrypted dataset just fine.
(Note that I have a separate /boot partition with the kernels, as I don't want to deal with grub's zfs support for now)

Description

zfs-load-key.sh is called by the dracut-pre-mount.service unit which has no explicit 'After' dependency on zfs-import.target. That way it can be that the pool has not yet been imported and the zfs-load-key.sh finishes without ever seeing the relevant pool.

How Has This Been Tested?

I build zfs packages for openSUSE, available at https://build.opensuse.org/project/show/home:lorenz:filesystems
This commit and the recently merged #11487 are included as a patch there, and the resulting packages are in active use by myself and a few others. With the patch, the affected dracut initrd zfs services are then active also on openSUSE.

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)
  • 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:

zfs-load-key.sh is called by the dracut-pre-mount.service unit which has
no explicit 'After' dependency on zfs-import.target. That way it can be
that the pool has not yet been imported and the zfs-load-key.sh finishes
without ever seeing the relevant pool.

Signed-off-by: Lorenz Hüdepohl <dev@stellardeath.org>
@behlendorf behlendorf added Component: Dracut dracut integration Status: Code Review Needed Ready for review and testing labels Jan 22, 2021
Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks reasonable to me based on the dracut documentation, but I haven't tested anything myself.

@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Jan 25, 2021
@behlendorf
Copy link
Contributor

@aerusso @rlaager I assume no concerns here for Debian or Ubuntu since my understanding is they don't use Dracut.

@aerusso
Copy link
Contributor

aerusso commented Jan 26, 2021

Debian does package dracut, and the Debian ZFS team packages zfs-dracut. I also personally use it on two ZFS on root machines.

Now with the (recently merged) path change to zgenhostid, Debian doesn't change very much related to dracut. So I think this should work as well on Debian as anywhere else.

Unfortunately, I don't have time right now to test this, though.

@behlendorf
Copy link
Contributor

Thanks for the feedback. I'll go ahead and merge this to master.

@behlendorf behlendorf merged commit caedada into openzfs:master Jan 26, 2021
behlendorf pushed a commit that referenced this pull request Feb 5, 2021
zfs-load-key.sh is called by the dracut-pre-mount.service unit which has
no explicit 'After' dependency on zfs-import.target. That way it can be
that the pool has not yet been imported and the zfs-load-key.sh finishes
without ever seeing the relevant pool.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Lorenz Hüdepohl <dev@stellardeath.org>
Closes #11500
jsai20 pushed a commit to jsai20/zfs that referenced this pull request Mar 30, 2021
zfs-load-key.sh is called by the dracut-pre-mount.service unit which has
no explicit 'After' dependency on zfs-import.target. That way it can be
that the pool has not yet been imported and the zfs-load-key.sh finishes
without ever seeing the relevant pool.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Lorenz Hüdepohl <dev@stellardeath.org>
Closes openzfs#11500
sempervictus pushed a commit to sempervictus/zfs that referenced this pull request May 31, 2021
zfs-load-key.sh is called by the dracut-pre-mount.service unit which has
no explicit 'After' dependency on zfs-import.target. That way it can be
that the pool has not yet been imported and the zfs-load-key.sh finishes
without ever seeing the relevant pool.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Lorenz Hüdepohl <dev@stellardeath.org>
Closes openzfs#11500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Dracut dracut integration Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants