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
F166374960: D52486.id162416.diff
Thu, Aug 13, 5:53 AM
F166374959: D52486.id162103.diff
Thu, Aug 13, 5:53 AM
F166374957: D52486.id161902.diff
Thu, Aug 13, 5:53 AM
F166374954: D52486.id161896.diff
Thu, Aug 13, 5:53 AM
F166374953: D52486.id.diff
Thu, Aug 13, 5:53 AM
F166374937: D52486.diff
Thu, Aug 13, 5:53 AM
Unknown Object (File)
Sun, Aug 9, 1:57 AM
Unknown Object (File)
Sat, Aug 8, 12:03 PM
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 Not Applicable
Unit
Tests Not Applicable

Event Timeline

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

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