HomeFreeBSD

witness: Record the first acquired file and line for recursable locks

Description

witness: Record the first acquired file and line for recursable locks

and the last acquired file and line to witness object.

For recursable locks, unfortunately current implementation records only
the recurse count and the last acquired file and line, but does not
restore the previous acquired file and line on unlock. Hence it is
possible to report false acquired file and line, and that may mislead
developers and make the report by users a little harder to analyse.

Since subsequent recurse locks do not affect how witness order check,
record the first acquired file and line so that the logic is much clear.

Reported by: bz
Reviewed by: kib (previous version), markj
See also: https://lists.freebsd.org/archives/freebsd-current/2025-June/007944.html
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D52496

(cherry picked from commit 2d85bc89294baa04daf509e81ec3880bff79cc10)
(cherry picked from commit 3dc9f96a489cd53710af8205a1f3901c11b760a5)
(cherry picked from commit 7838ad85fb1a75464e53525b4cdb064ca1e97a47)

Details

Provenance
zleiAuthored on Sep 17 2025, 4:48 PM
Reviewer
kib
Differential Revision
D52496: witness: Record the first acquired file and line for recursable locks
Parents
rGb4a079dd78a6: witness: White space cleanup and some style(9) tweeks
Branches
Unknown
Tags
Unknown