History log of /openbsd-src/sys/kern/vfs_subr.c (Results 1 – 25 of 327)
Revision Date Author Comments
# 29d460f4 02-Jan-2025 dlg <dlg@openbsd.org>

fix the WITNESS code in new vfs_busy()

found by hrvoje popovski


# 6233d59b 02-Jan-2025 dlg <dlg@openbsd.org>

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, an

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@

show more ...


# 78b7da88 31-Oct-2024 mvs <mvs@openbsd.org>

Unlock fs_sysctl(). It is the only `suid_clear' variable - atomically
accessed integer.

ok bluhm


# 5a0ec814 18-Oct-2024 miod <miod@openbsd.org>

Put the bowels of the various VOP_PRINT routines under
defined(DEBUG) || defined(DIAGNOSTIC) || defined(VFSLCKDEBUG)
as they won't be used otherwise.

Shaves a few bytes off installation kernels.

ok

Put the bowels of the various VOP_PRINT routines under
defined(DEBUG) || defined(DIAGNOSTIC) || defined(VFSLCKDEBUG)
as they won't be used otherwise.

Shaves a few bytes off installation kernels.

ok kn@ semarie@

show more ...


# 52bbc3a3 17-Oct-2024 dlg <dlg@openbsd.org>

use rw_status instead of interpreting RWL_OWNER to see if a lock is busy.

ok claudio@


# 129d5b53 13-Jul-2024 beck <beck@openbsd.org>

Revert the vdoom change, while it prevents the crashes on joel's go
builder and avoids the ufs_inactive problems, bluhm hits panics on
shutdown and filesystem unmount on the regress testers.

We'll h

Revert the vdoom change, while it prevents the crashes on joel's go
builder and avoids the ufs_inactive problems, bluhm hits panics on
shutdown and filesystem unmount on the regress testers.

We'll have to try the other approach of detecting the corrupted
vnode perhaps.

show more ...


# 3d7fd4aa 12-Jul-2024 beck <beck@openbsd.org>

Add vdoom() to fix ufs/ext2fs re-use of invalid vnode.

This was noticed by syzkiller and analyzed in isolaiton by mbuhl@
and visa@ two years ago. As the kernel has become more unlocked it
has starte

Add vdoom() to fix ufs/ext2fs re-use of invalid vnode.

This was noticed by syzkiller and analyzed in isolaiton by mbuhl@
and visa@ two years ago. As the kernel has become more unlocked it
has started to appear more and was being hit regularly by jsing@
on the Go builder.

The problem was during reclaim of a inode the corresponding vnode
could be picked up by a vget() by another thread while the inode
was being cleared out in the ufs_inactive routine and the thread running
ufs_inactive slept for i/o. When raced the vnode would then not have
zero use count and would not be cleared out on exit from ufs_inactive
with a dead/invalid vnode being used.

While this could get "fixed" by checking for the race happening
and trying again in the inactive routine, or by adding "yet another
visible vnode locking flag" we choose to add a vdoom() api for the
moment that allows the caller to block future attempts to grab this
vnode until it is cleared out fully with vclean.

Teste by jsing@ on the Go builder and seems to solve the issue.

ok kettenis@, claudio@

show more ...


# cb199c1b 05-Jul-2024 jsg <jsg@openbsd.org>

remove unused vn_isdisk(), added for softdep
ok kn@


# 81fb472f 03-Feb-2024 beck <beck@openbsd.org>

Remove Softdep.

Softdep has been a no-op for some time now, this removes it to get
it out of the way.

Flensing mostly done in Talinn, with some help from krw@

ok deraadt@


# a4cd45ee 26-Dec-2022 miod <miod@openbsd.org>

Replace two (void)copystr(..., NULL) with equivalent (void)strlcpy() calls.

ok millert@


# 0d280c5f 14-Aug-2022 jsg <jsg@openbsd.org>

remove unneeded includes in sys/kern
ok mpi@ miod@


# 4b515238 12-Aug-2022 visa <visa@openbsd.org>

Put more struct vnode fields under splbio().

Buffer cache related struct vnode fields can be accessed in interrupt
context. Be more consistent with the use of splbio().

OK mpi@


# 266a9dce 27-Mar-2022 semarie <semarie@openbsd.org>

sys/vnode.h cleanup for vnode_hold_list, vnode_free_list, struct freelst

vnode_hold_list and vnode_free_list aren't used outside kern/vfs_subr.c

move `struct freelst` where used in kern/vfs_subr.c

sys/vnode.h cleanup for vnode_hold_list, vnode_free_list, struct freelst

vnode_hold_list and vnode_free_list aren't used outside kern/vfs_subr.c

move `struct freelst` where used in kern/vfs_subr.c

no intented behaviour changes. survived a release(8) build.

ok millert@

show more ...


# 4cd1828e 25-Jan-2022 gnezdo <gnezdo@openbsd.org>

Capture a repeated pattern into sysctl_securelevel_int function

A few variables in the kernel are only writeable before securelevel is
raised. It makes sense to handle them with less code.

OK sthen

Capture a repeated pattern into sysctl_securelevel_int function

A few variables in the kernel are only writeable before securelevel is
raised. It makes sense to handle them with less code.

OK sthen@ bluhm@

show more ...


# 8e49fb4c 25-Oct-2021 claudio <claudio@openbsd.org>

Revert commitid: ufM9BcSbXqfLpzBH;
Move vfs_stall_barrier() from the fd layer into vn_lock() and the vfs layer.
In some cases it can result in a deadlock while suspending.
Discussed with mpi@ and der

Revert commitid: ufM9BcSbXqfLpzBH;
Move vfs_stall_barrier() from the fd layer into vn_lock() and the vfs layer.
In some cases it can result in a deadlock while suspending.
Discussed with mpi@ and deraadt@

show more ...


# da571ddd 24-Oct-2021 jsg <jsg@openbsd.org>

use NULL not 0 for pointer values in kern
ok semarie@


# 2c850ee8 23-Oct-2021 mpi <mpi@openbsd.org>

Sprinkle uvm_obj_destroy() over UVM object recycling code.

For now, only assert that the tree of pages is empty in uvm_obj_destroy().
This will soon be used to free the per-UVM object lock.

While h

Sprinkle uvm_obj_destroy() over UVM object recycling code.

For now, only assert that the tree of pages is empty in uvm_obj_destroy().
This will soon be used to free the per-UVM object lock.

While here call uvm_obj_init() when new vnodes are allocated instead of
in uvn_attach(). Because vnodes and there associated UVM object are
currently never freed, it isn't easy to know where/when to garbage
collect the associated lock. So simply check that the reference of a
given object is 0 when uvn_attach().

Tested by many as part of a bigger diff.

ok kettenis@

show more ...


# 57a040e7 23-Oct-2021 mpi <mpi@openbsd.org>

Assert that the KERNEL_LOCK() is held in vref(9).

This is a guard against pushing the lock too far in UVM's vnode land.

ok beck@


# fae85b1e 21-Oct-2021 claudio <claudio@openbsd.org>

Move vfs_stall_barrier() from the fd layer into vn_lock() and the vfs layer.
vfs stalling is used by suspend/resume and by vmt(4) to stall any
filesystem operation from altering the state on disk. Al

Move vfs_stall_barrier() from the fd layer into vn_lock() and the vfs layer.
vfs stalling is used by suspend/resume and by vmt(4) to stall any
filesystem operation from altering the state on disk. All these
operations will call vn_lock and be stalled. Adjust vfs_stall_barrier()
to allow the lock owner to still progress so that suspend can sync
the filesystems after stalling vfs operation.
OK mpi@

show more ...


# 05ee8c21 20-Oct-2021 semarie <semarie@openbsd.org>

revert vnode: remove VLOCKSWORK and check locking when vop_islocked != nullop
(both kernel and userland bits)

GENERIC + VFSLCKDEBUG is broken with it.


# 10dc0785 19-Oct-2021 semarie <semarie@openbsd.org>

vnode: remove VLOCKSWORK and check locking when vop_islocked != nullop

This flag is currently used to mark or unmark a vnode to actively
check vnode locking semantic (when compiled with VFSLCKDEBUG)

vnode: remove VLOCKSWORK and check locking when vop_islocked != nullop

This flag is currently used to mark or unmark a vnode to actively
check vnode locking semantic (when compiled with VFSLCKDEBUG).

Currently, VLOCKSWORK flag isn't properly set for several FS
implementation which have full locking support. This commit enable
proper checking for them too (cd9660, udf, fuse, msdosfs, tmpfs).

Instead of using a particular flag, it directly check if
v_op->vop_islocked is nullop or not to activate or not the vnode
locking checks.

ok mpi@

show more ...


# fb86feb3 31-Aug-2021 claudio <claudio@openbsd.org>

Swap lock flags so that LK_EXCLUSIVE is first like in all other places.


# 9d6122f6 28-Apr-2021 claudio <claudio@openbsd.org>

Introduce a global vnode_mtx and use it to make vn_lock() safe to be called
without the KERNEL_LOCK.
This moves VXLOCK and VXWANT to a mutex protected v_lflag field and also
v_lockcount is protected

Introduce a global vnode_mtx and use it to make vn_lock() safe to be called
without the KERNEL_LOCK.
This moves VXLOCK and VXWANT to a mutex protected v_lflag field and also
v_lockcount is protected by this mutex.

The vn_lock() dance is overly complex and all of this should probably replaced
by a proper lock on the vnode but such a diff is a lot more complex. This
is an intermediate step so that at least some calls can be modified to grab
the KERNEL_LOCK later or not at all.

OK mpi@

show more ...


# 1d6bfbaf 29-Jan-2021 claudio <claudio@openbsd.org>

Use NULL instead of 0 to clear v_socket pointer (which actually clears all
of the v_un pointers).
OK jsg@ mvs@


# 3018811d 23-Aug-2020 kn <kn@openbsd.org>

Remove unused debug_syncprt, improve debug sysctl handling

"syncprt" is unused since kern/vfs_syscalls.c r1.147 from 2008.

Adding new debug sysctls is a bit opaque and looking at kern/kern_sysctl.c

Remove unused debug_syncprt, improve debug sysctl handling

"syncprt" is unused since kern/vfs_syscalls.c r1.147 from 2008.

Adding new debug sysctls is a bit opaque and looking at kern/kern_sysctl.c
the only visible difference between used and stub ctldebug structs in the
debugvars[] array is their extern keyword, indicating that it is defined
elsewhere.

sys/sysctl.h declares all debugN members as extern upfront, but these
declarations are not needed.

Remove the unused debug sysctl, rename the only remaining one to something
meaningful and remove forward declarations from /sys/sysctl.h; this way,
adding new debug sysctls is a matter of adding extern and coming up with a
name, which is nicer to read on its own and better to grep for.

OK mpi

show more ...


12345678910>>...14