# Lustre HSM: state is not recovery evidence

Source review: 4 November 2026. Scope: Lustre v2_17_0, commit
4b0407a48e9e5b7f17877e8868080e9f40c238c6. Not a claim about every release,
PCC attach, backend implementation or running cluster.

## Findings

1. ARCHIVED is not a mutually exclusive state label. The official lfs-hsm
   manual itself prints "exists dirty archived". The state-set consistency
   checks permit that combination. Interpret the bitset, not one displayed word.
2. The ordinary release flag helper requires valid HSM metadata and ARCHIVED,
   and rejects DIRTY, NORELEASE or LOST. NOARCHIVE is a different policy bit:
   it does not by itself reject this helper. A true result is preliminary,
   not permission to delete or a complete release success.
3. The client opens a release lease and obtains the data version before
   issuing the close carrying release intent. In the ordinary server path,
   a broken lease fails, metadata is reread, and a not-already-released file's
   supplied version must equal its archived version. PCC attach has a separate
   branch; do not apply this ordinary-path summary to it.
4. The coordinator records a successful ARCHIVE completion's reported version,
   sets ARCHIVED, and clears DIRTY/LOST. A state query reads metadata; it does
   not fetch and validate the archive's payload. These are distinct observations.
5. The coordinator's restore compatibility check requires RELEASED and ARCHIVED
   without DIRTY/LOST. Its remove compatibility check excludes RELEASED files.
   These checks are not a promise of backend integrity, availability or retention.

The source links and digests are in sources.json. Use the named functions as
locators; all citations are pinned, not moving master URLs. The man-page's brief
"up-to-date" explanation must be read together with its dirty+archived example
and the actual release predicate. We do not infer backend bytes from a flag.

## Error interpretation and historical sources

In the pinned server function, flag rejection and version mismatch both use
-EPERM. Missing/broken leases use -ESTALE; open-semaphore contention uses
-EBUSY. This is not a full CLI-error map or an executed race experiment.
Do not diagnose permissions from that errno alone.

See [literature review](literature.md) for the 2015 policy-engine paper and
a historical whitepaper terminology caveat. Neither replaces the pinned code
or adds a backend recovery measurement.

## Engineering synthesis

HSM release changes data residency, while a backup policy specifies which
failures the recovery copy must survive. Record the Lustre file identity,
archive identifier and backend object mapping, source generation, completion
and error observations, backend credentials/keys, retention and a recovered
payload acceptance check. These are proposed evidence requirements, not fields
all supplied by lfs hsm_state. A successful metadata query is not a restore test.
After local data is released, the backend recovery path is essential to access.

Do not manually clear DIRTY or LOST or set ARCHIVED to make a release pass.
Such metadata changes are not data repair. This packet contains no release or
state-modifying shell commands.

## Reproduce the bounded check

Requires Python 3 and a C11 compiler; no Lustre mount or privileges.

    python3 inspect_release.py --sources /tmp/hesela-lustre-sources --fetch --output replay.json
    python3 -B -m unittest -v test_release.py

The script verifies six immutable source digests, extracts the original enum
and mdt_hsm_release_allow function, and compiles them with minimal field stubs.
It evaluates 128 non-PCC flag masks with HSM metadata absent/present. The 256
rows are synthetic helper inputs, not observed file states or 256 recovery
experiments. Some masks are unreachable; the arbitrary harness MA_HSM marker
is not a kernel ABI definition. Compare rows and upstream/helper/harness hashes
with evidence.json; compiler identification may differ.

No filesystem, locking, version race, copytool, archive medium or recovery
operation was exercised. Backend loss rates, recall latency, end-to-end
correctness and other releases remain unmeasured. This is source inspection
and an isolated function check by the same investigator, not peer replication.
