diff options
| author | 2026-09-15 08:22:19 -0400 | |
|---|---|---|
| committer | 2026-10-05 09:46:44 -0400 | |
| commit | 3c721c396f59039793d86e690520008c2ed86234 (patch) | |
| tree | dd20dbbfe5813eba5d490e2758527165db8bbed8 /scripts/Makefile.thinlto | |
| parent | pNFS: Discard a GETDEVICEINFO reply that raced a CHANGE notification (diff) | |
pNFS: Add deviceid reference query and collection walkers
The CB_NOTIFY_DEVICEID DELETE race recovery (RFC 8881 Section
18.40.4) needs to ask whether any live layout still references a
deviceID, and to enumerate those layouts for TEST_STATEID. Add a
layout_references_deviceid hook (sibling of reresolve_deviceid; the
flexfiles implementation memcmps each mirror stripe's decoded devid,
valid independent of the pinned device node) and two walkers over
the byserver pattern:
- pnfs_layout_deviceid_referenced_byclid(): boolean existence query,
early-stopping, entirely under i_lock.
- pnfs_layout_collect_deviceid_refs(): collects each matching layout
with the hdr pinned, the inode grabbed with its superblock active
(a pinned hdr does not hold its inode -- same discipline as the
bulk-destroy walker), and the layout stateid and cred snapshotted
under i_lock, so the caller can issue sleeping RPCs against the
collection.
The collection walker pins each matching header with a plain
pnfs_get_layout_hdr(), which cannot resurrect a dying header because
the walker holds i_lock and has checked NFS_I()->layout == lo.
pnfs_put_layout_hdr() drops the last reference under i_lock --
refcount_dec_and_lock() only decrements one to zero once it holds the
lock -- and clears NFS_I()->layout in that same critical section,
before it unlocks and frees. So a header still installed on its inode
cannot have reached a zero refcount.
That argument deliberately does not rest on NFS_LAYOUT_INVALID_STID.
A header can reach its final put while still valid: a full
LAYOUTRETURN ends in pnfs_layoutreturn_free_lsegs(), which resets the
layout stateid rather than invalidating it, and that is the ordinary
end of life for a return-on-close layout. The validity check the
walkers do apply is a policy filter, not a lifetime guarantee.
Because pnfs_put_layout_hdr() can send a layoutreturn and sleep, a
header pinned for a layout whose inode can no longer be grabbed is put
after the RCU read-side critical section, not within it.
Both ways the walk can end early report it. A GFP_ATOMIC allocation
failure aborts with -ENOMEM, and an inode that can no longer be
grabbed -- igrab() fails from I_FREEING on, while the layout may still
be valid and still name the deviceID -- aborts with -EAGAIN. Either
way the caller is told the collection is partial instead of receiving
a short list it would read as "no references".
No callers yet; no behavior change.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Benjamin Coddington <bcodding@hammerspace.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
