OpenBSD cvs log

created 2025-01-05T18:06:06Z
begin 2025-01-02T00:00:00Z
end 2025-01-03T00:00:00Z
path src/sys
commits 4

date 2025-01-02T01:19:22Z
author dlg
files src/sys/kern/vfs_subr.c log diff annotate
src/sys/sys/mount.h log diff annotate
message introduce reference counts on struct mount.

bluhm found that vfs_busy interacts badly with the rwlock change i
committed. the reason for this is that vfs_busy can call rw_enter with
RW_SLEEPFAIL, and while a thread is sleeping with SLEEPFAIL set, another
thread can actually destroy the mount the first thread is sleeping on.
destroy here means it actually frees the memory.

this works because current rwlocks do not touch the rwlock memory after
they sleep, they check the flag in the argument that was passed to it.
new rwlocks assume the rwlock they're sleeping on still exists after
they sleep, and updates some accounting after waking up. this is
incompatible with the subtle semantics that vfs is providing on top of
an rwlock.

this diff adds reference counting to struct mount. one ref is used by
the existing vfs_mount_alloc and vfs_mount free lifetime of the
mountpoint, but lets vfs_busy take a ref to the memory so it won't get
freed out from underneath it.

this also gets rid of the RW_SLEEPFAIL use in vfs_busy. the only reason
i can see that vfs_busy should fail to let a thread keep the rwlock
ownership is if the mount has been destroyed. vfs_mount_free sets a flag
that vfs_busy checks to see if that's the case or not.

this is the smallest change i could come up with to make vfs_busy safe
with the new rwlocks. i would suggest that in the future we should look
at having things take the struct mount ref before calling vfs_busy, but
that's a much bigger change.

ok claudio@ beck@ bluhm@

date 2025-01-02T10:07:18Z
author dlg
files src/sys/kern/vfs_subr.c log diff annotate
message fix the WITNESS code in new vfs_busy()

found by hrvoje popovski

date 2025-01-02T10:55:18Z
author bluhm
files src/sys/netinet/tcp_input.c log diff annotate
src/sys/netinet/tcp_var.h log diff annotate
message Reference count the listen inpcb in the TCP SYN cache.

To make progress in unlocking TCP input path, more reference counting
is needed. The SYN cache has a reference to the listen socket in
form of a struct tcpcb. Instead of adding a refcount to tcpcb, it
is easier to use a struct inpcb pointer which already has a refcount.
Acquire and hold the reference while running SYN cache timer.

OK mvs@

date 2025-01-02T23:26:50Z
author mglocker
files src/sys/dev/i2c/ihidev.c log diff annotate
message Fix the sequence of allocating the input buffer memory, so that it gets
allocated before we establish the interrupt handler, which requires this
buffer. This prevents that an early device interrupt would try to write
in to an uninitialized memory pointer.

The issue was reported by kirill@

ok kirill@, brynet@, kettenis@, mvs@