OpenBSD CVS

CVS log for src/sys/kern/vfs_vops.c


[BACK] Up to [local] / src / sys / kern

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.36 / (download) - annotate - [select for diffs], Mon May 13 11:17:40 2024 UTC (4 weeks, 1 day ago) by semarie
Branch: MAIN
CVS Tags: HEAD
Changes since 1.35: +10 -4 lines
Diff to previous 1.35 (colored)

vfs: VOP_REMOVE: move vnode unlocking and ref dropping to FS-indep part

while here, ensure all vop_remove field are set, and always call the function.

the change is very conservative: it only adds vnode ref drop/unlock where it was
absent because it should be unreachable (and if it wasn't, it should fix
things).

ok miod@

Revision 1.35 / (download) - annotate - [select for diffs], Sun Jun 26 05:20:42 2022 UTC (23 months, 2 weeks ago) by visa
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.34: +1 -17 lines
Diff to previous 1.34 (colored)

Remove unused VOP_POLL().

OK mpi@

Revision 1.34 / (download) - annotate - [select for diffs], Sun Dec 12 09:14:59 2021 UTC (2 years, 5 months ago) by visa
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.33: +5 -4 lines
Diff to previous 1.33 (colored)

Add vnode parameter to VOP_STRATEGY()

Pass the device vnode as a parameter to VOP_STRATEGY() to allow calling
the correct vop_strategy callback. Now the vnode is also available
in the callback.

OK mpi@

Revision 1.33 / (download) - annotate - [select for diffs], Wed Oct 20 06:35:39 2021 UTC (2 years, 7 months ago) by semarie
Branch: MAIN
Changes since 1.32: +5 -9 lines
Diff to previous 1.32 (colored)

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

GENERIC + VFSLCKDEBUG is broken with it.

Revision 1.32 / (download) - annotate - [select for diffs], Tue Oct 19 06:26:09 2021 UTC (2 years, 7 months ago) by semarie
Branch: MAIN
Changes since 1.31: +10 -6 lines
Diff to previous 1.31 (colored)

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@

Revision 1.31 / (download) - annotate - [select for diffs], Mon Oct 4 08:11:02 2021 UTC (2 years, 8 months ago) by claudio
Branch: MAIN
Changes since 1.30: +19 -99 lines
Diff to previous 1.30 (colored)

Use the fact the vnodes are locked when operations are inflight.
Remove the v_inflight member and alter the ffs and ext2fs sync code to
track inflight by checking if the node is locked or not (which it already
did before but for a different reason).
OK mpi@

Revision 1.30 / (download) - annotate - [select for diffs], Wed Apr 28 09:53:53 2021 UTC (3 years, 1 month ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.29: +3 -3 lines
Diff to previous 1.29 (colored)

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@

Revision 1.29 / (download) - annotate - [select for diffs], Wed Oct 7 12:33:03 2020 UTC (3 years, 8 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.28: +12 -1 lines
Diff to previous 1.28 (colored)

Document that `a_p' is always curproc by using a KASSERT().

One exception of this rule is VOP_CLOSE() where NULL is used instead
of curproc when the garbace collector of unix sockets, that runs in
a kernel thread, drops the last reference of a file.

This will allows for future simplifications of the VFS interfaces.

Previous version ok visa@, anton@.

ok kn@

Revision 1.28 / (download) - annotate - [select for diffs], Wed Apr 8 08:07:51 2020 UTC (4 years, 2 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.27: +3 -2 lines
Diff to previous 1.27 (colored)

Make fifo_kqfilter() honor FREAD|FWRITE just like fifo_poll() does.

Prevent generating events that do not correspond to how the fifo has been
opened.

ok visa@, millert@

Revision 1.27 / (download) - annotate - [select for diffs], Tue Mar 31 06:54:05 2020 UTC (4 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.26: +1 -12 lines
Diff to previous 1.26 (colored)

Revert previous, syzkaller found a way to trigger the KASSERT().

Let's fix this before we put them back :o)

Revision 1.26 / (download) - annotate - [select for diffs], Mon Mar 30 09:08:10 2020 UTC (4 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.25: +12 -1 lines
Diff to previous 1.25 (colored)

Document that `a_p' is always curproc by using a KASSERT().

This will allows for future simplifications of the VFS interfaces.

Tested in a bulk by naddy@ and visa@.

ok visa@, anton@

Revision 1.25 / (download) - annotate - [select for diffs], Fri Feb 14 11:57:56 2020 UTC (4 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.24: +2 -6 lines
Diff to previous 1.24 (colored)

The v_inflight counter was added to mark vnodes that currently do an operation
that modifies the filesystem as inflight. This is used in the sync calls (on
suspend and hibernate) to mark filesystems clean if no work is in flight.
VOP_UNLOCK() also got the v_inflight dance but VOP_UNLOCK does not alter
filesystem space and so it does not matter if VOP_UNLOCK() is currently run.
Also VOP_UNLOCK() does not sleep so there is no way for the sync code to see
an inflight VOP_UNLOCK().
OK visa@

Revision 1.24 / (download) - annotate - [select for diffs], Thu Feb 13 08:47:10 2020 UTC (4 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.23: +1 -13 lines
Diff to previous 1.23 (colored)

Move the LK_DRAIN logic from VOP_LOCK() to vclean() the only caller of
VOP_LOCK with LK_DRAIN. This simplifies VOP_LOCK() a fair bit.
OK visa@

Revision 1.23 / (download) - annotate - [select for diffs], Sun Dec 8 12:29:42 2019 UTC (4 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.22: +2 -2 lines
Diff to previous 1.22 (colored)

Convert infinite sleeps to tsleep_nsec(9).

ok visa@, jca@

Revision 1.22 / (download) - annotate - [select for diffs], Mon Aug 26 18:56:29 2019 UTC (4 years, 9 months ago) by anton
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.21: +13 -1 lines
Diff to previous 1.21 (colored)

When a thread tries to exclusively lock a vnode, the same thread must
ensure that any other thread currently trying to acquire the underlying
vnode lock has observed that the same vnode is about to be exclusively
locked. Such threads must then sleep until the exclusive lock has been
released and then try to acquire the lock again. Otherwise, exclusive
access to the vnode cannot be guaranteed.

Thanks to naddy@ and visa@ for testing; ok visa@

Reported-by: syzbot+374d0e7e2400004957f7@syzkaller.appspotmail.com

Revision 1.21 / (download) - annotate - [select for diffs], Fri May 3 14:24:13 2019 UTC (5 years, 1 month ago) by visa
Branch: MAIN
Changes since 1.20: +2 -6 lines
Diff to previous 1.20 (colored)

Make VOP_ADVLOCK() safe to use without kernel lock

All non-dummy implementations of VOP_ADVLOCK() rely on lf_advlock()
which is now safe to use without the kernel lock. Because VOP_ADVLOCK()
does not make the vnode dirty, it is unnecessary to keep track of
in-flight vnode lock operations and the updating of vnode->v_inflight
can be dropped from VOP_ADVLOCK(). This makes VOP_ADVLOCK() safe to use
without the kernel lock.

OK tedu@ mpi@

Revision 1.20 / (download) - annotate - [select for diffs], Sun Feb 17 22:17:28 2019 UTC (5 years, 3 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.19: +6 -2 lines
Diff to previous 1.19 (colored)

if a write fails, we mark the buffer invalid and throw it away. this can
lead to lost errors, where a later fsync will return success. to fix this,
set a flag on the vnode indicating a past error has occurred, and return
an error for future fsync calls.
ok bluhm deraadt visa

Revision 1.19 / (download) - annotate - [select for diffs], Thu Jun 21 14:17:23 2018 UTC (5 years, 11 months ago) by visa
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.18: +3 -1 lines
Diff to previous 1.18 (colored)

Drop redundant "node == parent node" checks from VOP_RMDIR()
implementations. Rely on the VFS layer to do the checking.

OK mpi@, helg@

Revision 1.18 / (download) - annotate - [select for diffs], Sat Apr 28 03:13:05 2018 UTC (6 years, 1 month ago) by visa
Branch: MAIN
Changes since 1.17: +3 -5 lines
Diff to previous 1.17 (colored)

Clean up the parameters of VOP_LOCK() and VOP_UNLOCK(). It is always
curproc that does the locking or unlocking, so the proc parameter
is pointless and can be dropped.

OK mpi@, deraadt@

Revision 1.17 / (download) - annotate - [select for diffs], Sat Feb 10 05:24:23 2018 UTC (6 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.16: +112 -23 lines
Diff to previous 1.16 (colored)

Syncronize filesystems to disk when suspending.  Each mountpoint's vnodes
are pushed to disk.  Dangling vnodes (unlinked files still in use) and
vnodes undergoing change by long-running syscalls are identified -- and
such filesystems are marked dirty on-disk while we are suspended (in case
power is lost, a fsck will be required).  Filesystems without dangling or
busy vnodes are marked clean, resulting in faster boots following
"battery died" circumstances.
Tested by numerous developers, thanks for the feedback.

Revision 1.16 / (download) - annotate - [select for diffs], Mon May 23 09:31:28 2016 UTC (8 years ago) by natano
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.15: +1 -16 lines
Diff to previous 1.15 (colored)

VOP_REALLOCBLKS() and related code is unused since the removal of
cluster_write().
ok beck zhuk

Revision 1.15 / (download) - annotate - [select for diffs], Sat Mar 19 12:04:15 2016 UTC (8 years, 2 months ago) by natano
Branch: MAIN
Changes since 1.14: +2 -3 lines
Diff to previous 1.14 (colored)

Remove the unused flags argument from VOP_UNLOCK().

torture tested on amd64, i386 and macppc
ok beck mpi stefan
"the change looks right" deraadt

Revision 1.14 / (download) - annotate - [select for diffs], Sun Jul 19 16:21:11 2015 UTC (8 years, 10 months ago) by beck
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9, OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.13: +5 -1 lines
Diff to previous 1.13 (colored)

Use two 2q caches for the buffer cache, moving previously warm buffers from the
first queue to the second.
Mark the first queue as DMA in preparation for being able to use more memory
by flipping. Flipper code currently only sets and clears the flag.
ok tedu@ guenther@

Revision 1.13 / (download) - annotate - [select for diffs], Fri May 1 01:30:58 2015 UTC (9 years, 1 month ago) by millert
Branch: MAIN
Changes since 1.12: +3 -2 lines
Diff to previous 1.12 (colored)

Pass fflag to VOP_POLL so vfs fifo functions can get at the file
flags to check FREAD/FWRITE if needed.  This will be used by fifo_poll
to avoid checking the write end of the fifo when the fd is read-only.
OK guenther@

Revision 1.12 / (download) - annotate - [select for diffs], Sat Mar 14 03:38:51 2015 UTC (9 years, 3 months ago) by jsg
Branch: MAIN
Changes since 1.11: +1 -2 lines
Diff to previous 1.11 (colored)

Remove some includes include-what-you-use claims don't
have any direct symbols used.  Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@

Revision 1.11 / (download) - annotate - [select for diffs], Mon Jan 19 20:16:27 2015 UTC (9 years, 4 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.10: +3 -1 lines
Diff to previous 1.10 (colored)

Oops, missed the new #include when manually applying the diff from
Helg (xx404 (at) msn.com)

Revision 1.10 / (download) - annotate - [select for diffs], Mon Jan 19 20:13:03 2015 UTC (9 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.9: +6 -5 lines
Diff to previous 1.9 (colored)

Fix bracing in ASSERT_VP_ISLOCKED(vp) macro to not always panic()

From Helg (xx404 (at) msn.com)

Revision 1.9 / (download) - annotate - [select for diffs], Tue Aug 13 05:52:24 2013 UTC (10 years, 10 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.8: +2 -4 lines
Diff to previous 1.8 (colored)

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types.  Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments.  Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir.  Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility.  Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@

Revision 1.8 / (download) - annotate - [select for diffs], Tue Jul 9 15:37:43 2013 UTC (10 years, 11 months ago) by beck
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.7: +0 -5 lines
Diff to previous 1.7 (colored)

back out the cache flipper temporarily to work out of tree.
will come back soon.
ok deraadt@

Revision 1.7 / (download) - annotate - [select for diffs], Tue Jun 11 19:01:20 2013 UTC (11 years ago) by beck
Branch: MAIN
Changes since 1.6: +6 -1 lines
Diff to previous 1.6 (colored)

High memory page flipping for the buffer cache.

This change splits the buffer cache free lists into lists of dma reachable
buffers and high memory buffers based on the ranges returned by pmemrange.
Buffers move from dma to high memory as they age, but are flipped to dma
reachable memory if IO is needed to/from and high mem buffer. The total
amount of buffers  allocated is now bufcachepercent of both the dma and
the high memory region.

This change allows the use of large buffer caches on amd64 using more than
4 GB of memory

ok tedu@ krw@ - testing by many.

Revision 1.6 / (download) - annotate - [select for diffs], Tue Jun 11 16:42:16 2013 UTC (11 years ago) by deraadt
Branch: MAIN
Changes since 1.5: +3 -3 lines
Diff to previous 1.5 (colored)

final removal of daddr64_t.  daddr_t has been 64 bit for a long enough
test period; i think 3 years ago the last bugs fell out.
ok otto beck others

Revision 1.5 / (download) - annotate - [select for diffs], Thu Mar 28 02:08:39 2013 UTC (11 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.4: +21 -1 lines
Diff to previous 1.4 (colored)

Handle the pathconf _PC_PATH_MAX, _PC_PIPE_BUF, _PC_ASYNC_IO,
_PC_PRIO_IO, and _PC_SYNC_IO names in VOP_PATHCONF(), as they're
fs-independent for us.  Since we don't support latter three on any
fs, we can also define the related _POSIX_{ASYNC,PRIO,SYNC}_IO
symbols in <unistd.h> (via sys/unistd.h) with value -1.

Also, zap pointless tty-only values from procfs(!).

ok beck@, deraadt@

Revision 1.4 / (download) - annotate - [select for diffs], Sat Jul 2 15:52:25 2011 UTC (12 years, 11 months ago) by thib
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.3: +2 -2 lines
Diff to previous 1.3 (colored)

rename VFSDEBUG to VFLCKDEBUG;

prompted by tedu@

Revision 1.3 / (download) - annotate - [select for diffs], Tue Apr 5 14:14:07 2011 UTC (13 years, 2 months ago) by thib
Branch: MAIN
Changes since 1.2: +72 -38 lines
Diff to previous 1.2 (colored)

Every single vop_default is set to eopnotsupp, so retire it
and return EOPNOTSUPP directly from the VOP_* functions.

Filesystems should, at some point fill in every function
in the vop_default struct so we can get rid of the 'if'
statements in VOP_*.

Revision 1.2 / (download) - annotate - [select for diffs], Wed Sep 8 10:50:27 2010 UTC (13 years, 9 months ago) by thib
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.1: +1 -0 lines
Diff to previous 1.1 (colored)

Add $OpenBSD$ prompted by mikeb@

Revision 1.1 / (download) - annotate - [select for diffs], Mon Sep 6 23:44:10 2010 UTC (13 years, 9 months ago) by thib
Branch: MAIN

End the VOP experiment. Instead of the ridicolusly complicated operation
vector setup that has questionable features (that have, as far as I can
tell never been used in practice, atleast not in OpenBSD), remove all
the gunk and favor a simple struct full of function pointers that get
set directly by each of the filesystems.

Removes gobs of ugly code and makes things simpler by a magnitude.

The only downside of this is that we loose the vnoperate feature so
the spec/fifo operations of the filesystems need to be kept in sync
with specfs and fifofs, this is no big deal as the API it self is pretty
static.

Many thanks to armani@ who pulled an earlier version of this diff to
current after c2k10 and Gabriel Kihlman on tech@ for testing.

Liked by many. "come on, find your balls" deraadt@.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.