Page MenuHomeFreeBSD

lockf: Avoid spinning when operating on an fd
ClosedPublic

Authored by des on Apr 29 2026, 10:50 PM.
Tags
None
Referenced Files
F174971841: D56722.id177072.diff
Wed, Oct 7, 7:14 AM
F174955970: D56722.id176831.diff
Wed, Oct 7, 4:41 AM
Unknown Object (File)
Wed, Oct 7, 2:32 AM
Unknown Object (File)
Thu, Oct 1, 11:29 PM
Unknown Object (File)
Thu, Oct 1, 6:03 PM
Unknown Object (File)
Thu, Oct 1, 6:00 PM
Unknown Object (File)
Thu, Oct 1, 3:32 PM
Unknown Object (File)
Wed, Sep 30, 10:43 PM
Subscribers

Details

Summary

When operating on a file descriptor, acquire_lock() would ignore the
flags argument and always operate in non-blocking mode, resulting in
unnecessary busy-looping.

PR: 294832
MFC after: 1 week

Diff Detail

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

Event Timeline

des requested review of this revision.Apr 29 2026, 10:50 PM
markj added a subscriber: markj.
markj added inline comments.
usr.bin/lockf/lockf.c
322–324

Better would be to declare lflags in this block, it's only used there.

This revision is now accepted and ready to land.May 2 2026, 5:28 PM
This revision now requires review to proceed.May 2 2026, 6:52 PM
This revision is now accepted and ready to land.May 3 2026, 3:25 PM