An interface to retrieve the list of advisory file locks.
procstat(1) implementation might follow, but it is too much work ATM. Main target is lsof.
Differential D34756
Add KERN_LOCKF kib on Apr 2 2022, 10:41 PM. Authored by Tags None Referenced Files
Subscribers
Details
An interface to retrieve the list of advisory file locks. procstat(1) implementation might follow, but it is too much work ATM. Main target is lsof.
Diff Detail
Event TimelineComment Actions I'll admit I didn't look at the code in detail, but it looks ok to me. It won't be useful for NFSv4, since the locks are not kept in A VOP call would allow the NFSv4 client to report locks ps: Good to see that you are at least able to do some stuff. I can't imagine what living in Kyiv would be like right now. Comment Actions pathes are documented in libprocstat(3) as optional. When I thought about the code structure, I indeed considered two options: either iterate over lf_lock_states list, as is done in the current review, or iterate over all vnodes and then looking at v_lockf for it. Second option did not stayed for too long, because we typically have several millions of vnodes cached, while typical system only have several dozens of locks. Second option was considered at all because the locking is more natural for it: vnode lock is before lockf state locks. I have to do some trick which slightly decreases the consistency of the reported snapshot. May be we could have some additional code to iterate over NFSv4+ mounts to gather fs-specific adv lock implementation data. This definitely cannot be VOP, it should be VFS_OP-like interface, for later.
Comment Actions Looks fine to me now. I can cobble to-gether a nfs_report_lockf() once this goes
|