Page MenuHomeFreeBSD

vnode read(2)/write(2): acquire rangelock regardless of do_vn_io_fault()
ClosedPublic

Authored by kib on Jul 23 2023, 4:02 PM.
Tags
None
Referenced Files
F151378886: D41158.id125055.diff
Wed, Apr 8, 12:24 AM
Unknown Object (File)
Sun, Mar 29, 6:25 AM
Unknown Object (File)
Fri, Mar 20, 11:52 AM
Unknown Object (File)
Thu, Mar 19, 6:47 PM
Unknown Object (File)
Wed, Mar 18, 4:13 AM
Unknown Object (File)
Tue, Mar 17, 9:38 PM
Unknown Object (File)
Sun, Mar 15, 7:37 AM
Unknown Object (File)
Feb 27 2026, 9:41 AM
Subscribers

Details

Summary
To ensure atomicity of reads against parallel writes and truncates,
vnode lock was not enough at least since introduction of vn_io_fault().
That code only take rangelock when it was possible that vn_read() and
vn_write() could drop the vnode lock.

At least since the introduction of VOP_READ_PGCACHE() which generally
does not lock the vnode at all, rangelocks become required even
for filesystems that do not need vn_io_fault() workaround.  For
instance, tmpfs.

PR:     272678
Analyzed by:    Andrew Gierth  <andrew@tao11.riddles.org.uk>

Diff Detail

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