Page MenuHomeFreeBSD

kern/vfs_vnops.c: generalize the lock primitive for file foffset
ClosedPublic

Authored by kib on Sep 11 2025, 10:10 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 19, 11:20 AM
Unknown Object (File)
Fri, Apr 17, 2:24 AM
Unknown Object (File)
Thu, Apr 16, 3:55 AM
Unknown Object (File)
Tue, Apr 14, 12:24 PM
Unknown Object (File)
Sun, Apr 12, 3:34 AM
Unknown Object (File)
Sat, Apr 11, 9:17 PM
Unknown Object (File)
Thu, Apr 9, 7:32 AM
Unknown Object (File)
Thu, Apr 9, 6:45 AM
Subscribers

Details

Summary
Generalize foffset_lock/unlock() by splitting the locking info
file_v_lock/unlock() (LP64 case) or file_v_lock/unlock_mtxp() for ILP32
(using mutex pool) and then taking the action to read the offset.

sys/file.h: rename struct file f_vnread_flags member into generic f_vflags

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib requested review of this revision.Sep 11 2025, 10:10 AM
sys/kern/vfs_vnops.c
871

Note that f_offset is no longer read under the sleepq lock in this case, but it does not matter.

sys/kern/vfs_vnops.c
818

Should this be state | lock_bit?

kib marked an inline comment as done.Sep 11 2025, 1:54 PM
kib added inline comments.
sys/kern/vfs_vnops.c
810

There too.

sys/kern/vfs_vnops.c
804
813

and below

854

Why not use flagsp here?

kib marked 3 inline comments as done.

Remove unneeded volatile qualifier for var accessed as atomic.
Systematically use flagsp.

This revision is now accepted and ready to land.Sep 15 2025, 7:33 PM