Deferred deletion
Deferred deletion #
A delete-pending mark is authorized when it is set, and the setting open's token is recorded with it (Sharing and Deletion). At the last close there is no re-authorization against the closing task. Instead a synchronous, non-nesting internal deletion scope is armed for the outer path the marking open named, captured when the mark was set, and StrataFS binds it once to the exact provider parent, dentry and inode selected from the descriptor's settled provider. Only the corresponding outer and lower unlink calls match, and the scope is cleared on every return.
The mechanism never turns an ordinary close into deletion authority, never admits a different provider entry, and never permits unlinking an entry that no longer names the descriptor's inode. If the original entry has disappeared or changed identity, the deletion is already complete and no exemption is used.
Deferred deletion #
A request to delete an object when the last descriptor to it is closed applies to the object the descriptor resolved to, not to whatever provides that name at close time. Because removal (Removal) is defined over the current provider of a name, the deferred case has its own path.
An entry already gone #
When the deletion is attempted, stratafs locates the entry at the path the descriptor was opened against, in the stratum that provided it at that time — the descriptor's private dentry carries both — and resolves the parent in that same stratum. Four conditions end the attempt quietly, reporting success because the deletion is already complete: the parent is gone, the name is gone, the name now identifies a different inode, or the unlink raced.
The merged parent can disappear or become a non-directory before the
VFS reaches stratafs’s unlink handler. An ENOENT or ENOTDIR from
that earlier check is also a successful no-op, but only after a lookup
in the descriptor’s original providing stratum confirms that its
recorded name is absent or identifies a different inode. A higher
stratum masking a still-live backing target does not satisfy that
condition: the deletion still fails and is audited. Other errors keep
their ordinary failure and audit behavior.
The original stratum must accept removal #
That stratum must accept modification, or the deletion fails with
EROFS. Then the entry is removed, and no other. In particular, where
another caller's copy-up has published a new object at that name in a
higher stratum, that object is not the one being deleted and is left
alone.
Failures are audited #
Because the attempt has no caller to report to, any failure is audited — and for a deferred deletion, every non-zero result is audited, not only the arrangement errors Audit covers for ordinary refusals. The object is left in place.
Authority at deletion time #
The right to delete the entry is checked against the directory of the stratum where the entry lives, not against the merged parent, and it is checked at deletion time rather than only at arm.
Arm time could not do it. The authorizer there holds a struct file,
and which stratum provides the entry is stratafs-internal — the
provider index and the parent's relative path are not visible to KACS.
stratafs computes that directory before removing anything, so the check
happens there, where the answer exists.
The requesting token outlives the arm #
The token is the one that requested the deferred deletion, not the
credentials of whoever closes the descriptor. That requires it to
outlive the arm: the file's blob takes a reference when armed and
releases it in ->file_release, on both the armed and unarmed exits.
The file is the thing that was armed, so its lifetime is the right
one — arm and close may be far apart and in different tasks.
Supported object types #
Deferred deletion is restricted to non-directories, and at arm time to regular files on a managed mount.