CP-11462 ZOA infrastructure for snapshot reference and hold management#121
Open
lyriclake wants to merge 3 commits into
Open
CP-11462 ZOA infrastructure for snapshot reference and hold management#121lyriclake wants to merge 3 commits into
lyriclake wants to merge 3 commits into
Conversation
Adds Rust bindings and safe wrappers for two new libzfs_core symbols
introduced in delphix/zfs CP-11462:
- lzc_list_snapshot_refs: enumerates snapshots in a pool that carry the
DS_FIELD_SNAPSHOT_REFERENCE ZAP entry, returning each snapshot's guid
and sender-assigned ref_id. Used by ZOA's child reconciler to recover
missing recv-refs and write missing delete-refs.
- lzc_list_pool_holds: enumerates user holds across every snapshot in a
pool, optionally filtered by tag prefix. Used by ZOA's parent
reconciler with prefix "snapref:" to find and release orphaned holds.
The safe wrappers (Zfs::list_snapshot_refs, Zfs::list_pool_holds)
mirror the existing HoldList iterator pattern. PoolHoldList flattens
the kernel's two-level snap -> { tag -> time } map into a
(snap, tag, created_at) iterator.
Bumps zfs-core and zfs-core-sys to 0.5.1-delphix0.
delphix/rust-libzfs does not have lzc_list_pool_holds in its ZFS kernel interface, so remove the sys binding and the Rust wrapper. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
ZOA's snapshot reference-tracking work (CP-11226 / "remote provisioning")
needs a read-only enumeration from the kernel that no existing
libzfs_coresymbol provides:List every snapshot in a pool that carries the
DS_FIELD_SNAPSHOT_REFERENCEZAP entry, along with itsguidandsender-assigned
ref_id. The child reconciler uses this to recovermissing recv-refs and write missing delete-refs.
The corresponding C symbol
lzc_get_snapshot_refsis added indelphix/zfs CP-11462: https://github.com/delphix/zfs/pull/2232. This PR is the matching rust-libzfs side: without
a safe wrapper ZOA cannot call it.
Solution
Add an FFI declaration for
lzc_get_snapshot_refsinzfs-core-sys/src/bindings.rs, plus a matching safe wrapper inzfs-core/src/lib.rs:Zfs::get_snapshot_refs(fsname)returns aSnapshotRefListwhoseIntoIteratoryieldsSnapshotRef { name, guid, ref_id }triples.The list type mirrors the shape of the existing
HoldList/HoldListIterpair. The binding is hand-added rather than regeneratedso this PR doesn't churn unrelated bindgen output; the next regen
against an updated
libzfs_core.hwill pick it up identically becausegenerate-bindingsalready whitelistslzc_.*.Bumps
zfs-coreandzfs-core-systo0.5.1-delphix0.Testing Done
LIBZFS_CORE_LOOKUP_WITH=link cargo check -p zfs-core— clean.(The 11 warnings emitted are pre-existing
#[cfg(features = ...)]typos, untouched by this PR.)
zfs_object_agent list-snapshot-refs child-poolreturned one entry with the expected(guid, ref_id)after a layered send/recv. The all-pools form (
zfs_object_agent list-snapshot-refswith no args,using
zpool listenumeration) also returned the same entry correctly.pass-through over the C function plus standard nvlist
destructuring; the meaningful coverage lives in the kernel side
and in the consuming reconcilers in zettaobject (CP-11226).