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)
Fri, Oct 10, 10:17 AM
Unknown Object (File)
Fri, Oct 10, 10:17 AM
Unknown Object (File)
Fri, Oct 10, 10:16 AM
Unknown Object (File)
Fri, Oct 10, 10:16 AM
Unknown Object (File)
Fri, Oct 10, 10:16 AM
Unknown Object (File)
Fri, Oct 10, 3:44 AM
Unknown Object (File)
Mon, Oct 6, 11:46 PM
Unknown Object (File)
Mon, Oct 6, 1:10 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 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