Page MenuHomeFreeBSD

vn_lock_pair(): Support passing LK_NODDLKTREAT
ClosedPublic

Authored by olce on Jul 9 2023, 6:14 PM.
Tags
None
Referenced Files
Unknown Object (File)
Apr 5 2024, 2:34 AM
Unknown Object (File)
Apr 4 2024, 11:47 PM
Unknown Object (File)
Mar 6 2024, 10:21 PM
Unknown Object (File)
Mar 1 2024, 4:53 AM
Unknown Object (File)
Jan 10 2024, 9:44 AM
Unknown Object (File)
Dec 23 2023, 12:29 AM
Unknown Object (File)
Dec 12 2023, 12:08 AM
Unknown Object (File)
Nov 27 2023, 12:44 AM
Subscribers

Details

Summary

Since this function ultimately calls vn_lock() or VOP_LOCK1(), allows it to
receive and pass this flag which is used in the lookup code and doesn't
interfere with the function's operation.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

olce requested review of this revision.Jul 9 2023, 6:14 PM
This revision is now accepted and ready to land.Jul 11 2023, 12:46 PM

What are the useful flags for the ops? For instance, LK_SLEEPFAIL also makes no sense, as well as LK_TIMELOCK. In fact I do not see any useful flags for vn_lock_pair()

I have not analyzed all LK_ flags, and just excluded the most obvious ones.

My principal goal doing this is to be able to pass LK_NODDLKTREAT and use vn_lock_pair() in vfs_lookup() (to remove vp_crossmp; see next differential in the stack). You may think it doesn't make sense if you assume that no other vnode is locked than the two passed to the function, but ffs_lock() actually relies on the presence of LK_NODDLKTREAT to add LK_ADAPTIVE internally (the reason of which I don't know). As another example, LK_INTERLOCK would make sense as well, but supporting it requires (small) changes.

From a cursory look, I don't think any other flags would make sense indeed.

So what about just checking for LK_NODDLKTREAT explicitly and not allowing other flags? (And possibly add LK_INTERLOCK with the required support code.)

LK_NODDLKTREAT is not about other vnodes being locked, it has something to do with the priority of lock acquire (it was an old attempt to fix some LoRs with the vm_fault AFAIR).

Please do only enable the flag instead of allowing everything.

olce retitled this revision from vn_lock_pair(): Support more flags in lkflags to vn_lock_pair(): Support passing LK_NODDLKTREAT.
olce edited the summary of this revision. (Show Details)

Only additionally support LK_NODDLKTREAT.

This revision now requires review to proceed.Jul 13 2023, 6:07 PM

Send me fully formatted git patch, please.

This revision is now accepted and ready to land.Jul 14 2023, 3:42 AM
This revision was automatically updated to reflect the committed changes.