Add recursive dataset mounting support to pam_zfs_key #16857
+326
−78
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Title
Add recursive dataset mounting support to pam_zfs_key
Motivation and Context
This change introduces the ability to recursively mount ZFS datasets using a new configuration option,
mount_recursively
. This enhancement solves the need for hierarchical or nested dataset management in environments that utilizepam_zfs_key
, ensuring all eligible child datasets are mounted as part of the session functionality.This feature improves the flexibility and usability of
pam_zfs_key
when managing complex dataset organizations.Description
mount_recursively
, which ensures child datasets of a given root can also be mounted.decrypt_mount()
function to integrate recursive mounting functionality, leveragingzfs_iter_filesystems_v2
for child dataset traversal.canmount
andmountpoint
are respected during recursive mounting.zfs_key_config_t
) to include themount_recursively
option.pam_mount_recursively.ksh
, to validate recursive mounting behavior and edge cases (e.g., "none", "legacy", "noauto", and "off" mountpoints).How Has This Been Tested?
Added a functional test (
tests/zfs-tests/tests/functional/pam/pam_mount_recursively.ksh
) that:mount_recursively
flag enabled.canmount
andmountpoint
properties).open_session
andclose_session
) via PAM.canmount=on
and appropriate mountpoint properties.Manual testing performed on Linux configurations using
pamtester
to ensure real-world applicability.Verified backward compatibility where
mount_recursively
is not enabled.Types of Changes
Checklist
Signed-off-by
.Let me know if additional details are required.