History log of /freebsd-10-stable/sys/kern/vfs_subr.c
Revision Date Author Comments
# 328997 07-Feb-2018 mckusick

Adjust MFC in r328946 to stable/10.
This is a direct commit to the branch.


# 328946 06-Feb-2018 mckusick

MFC of 328643.

fix vn_printf listing of its union


# 324966 25-Oct-2017 markj

MFC r324704:
Fix a racy VI_DOOMED check in MNT_VNODE_FOREACH_ALL().


# 316543 05-Apr-2017 brooks

MFC r316497:

Correct a kernel stack leak in 32-bit compat when vfc_name is short.

Don't zero unused pointer members again.

Per discussion with secteam we are not issuing an advisory for this
issue as we have no current evidence it leaks exploitable information.

Reviewed by: rwatson, glebius, delphij
Sponsored by: DARPA, AFRL


# 303291 25-Jul-2016 kib

MFC r302567:
In vgonel(), postpone setting BO_DEAD until VOP_RECLAIM() is called,
if vnode is VMIO. For VMIO vnodes, set BO_DEAD in vm_object_terminate().

MFC r302580:
Fix grammar.


# 302234 27-Jun-2016 bdrewery

MFC r298819:

sys/kern: spelling fixes in comments.


# 300484 23-May-2016 avg

MFC r299916: vfs_read_dirent: increment ncookies after adding a cookie


# 299886 16-May-2016 kib

MFC r298982:
Add EVFILT_VNODE open, read and close notifications.

MFC r298984:
Correct wording.


# 299885 16-May-2016 kib

MFC r287831 (by cem):
Note DOOMED vnodes with NOTE_REVOKE.


# 299882 16-May-2016 kib

MFC r298922:
Issue NOTE_EXTEND when a directory entry is added to or removed from
the monitored directory as the result of rename(2) operation. The
renames staying in the directory are not reported.


# 299881 16-May-2016 kib

MFC r298921:
Fix reporting of NOTE_LINK when directory link count changes due to
rename removing or adding subdirectory entry.


# 295905 22-Feb-2016 marius

In preparation for 10.3-RELEASE, temporarily revert the MFC of r291244
done as part of r292895 on stable/10 as that change causes hangs with
ZFS and the cause on at least amd64 so far not understood.
Discussed with: kib
For further information see:
https://lists.freebsd.org/pipermail/freebsd-stable/2016-February/084045.html

PR: 207281
Approved by: re (gjb)


# 293759 12-Jan-2016 trasz

Hide the "unmount of /dev failed (BUSY)" warning at shutdown or reboot,
introduced with r293742, just like it was hidden before that commit.

This is a direct commit to 10-STABLE; this special case is not needed
in 11-CURRENT, because devfs supports forced unmounts there. The forced
unmount could be MFC-ed, but there are some LORs at shutdown, and I have
a weird feelings about it.

Sponsored by: The FreeBSD Foundation


# 293742 12-Jan-2016 trasz

MFC r287107:

Make vfs_unmountall() unmount /dev after /, not before. The only
reason this didn't result in an unclean shutdown is that devfs ignores
MNT_FORCE flag.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3467


# 292895 29-Dec-2015 mckusick

MFC of 291244, 291380, 291459, 291460, 291671, and 291743:

This MFC includes changes to better manage the vnode freelist
and to streamline the allocation and freeing of vnodes.

Note that to maintain the KPI the VI_AGE flag is left defined
in sys/vnode.h though its use is dropped as described in 291380.
To maintain KBI the vfs.vlru_alloc_cache_src sysctl variable
remains though it no longer has any effect as described in 291244.

MFC of 291244:
Move the comment about resident pages preventing vnode from leaving
active list, into the header comment for vdrop(), which is the
function that decides whether to leave the vnode on the list. Note
that dirty page write-out in vinactive() is asynchronous.

Discussed with: alc
Sponsored by: The FreeBSD Foundation

MFC of 291380:
Remove VI_AGE vnode iflag, it is unused.

Noted by: bde
Sponsored by: The FreeBSD Foundation

MFC of 291459:
For performance reasons, it is useful to have a single string used as
the name of a filesystem when setting it as the first parameter to the
getnewvnode() function. Most filesystems call getnewvnode from just one
place so can use a literal string as the first parameter. However, NFS
calls getnewvnode from two places, so we create a global constant string
that can be used by the two instances. This change also collapses two
instances of getnewvnode() in the UFS filesystem to a single call.

Reviewed by: kib
Tested by: Peter Holm

MFC of 291460:
As the kernel allocates and frees vnodes, it fully initializes them
on every allocation and fully releases them on every free. These
are not trivial costs: it starts by zeroing a large structure then
initializes a mutex, a lock manager lock, an rw lock, four lists,
and six pointers. And looking at vfs.vnodes_created, these operations
are being done millions of times an hour on a busy machine.

As a performance optimization, this code update uses the uma_init
and uma_fini routines to do these initializations and cleanups only
as the vnodes enter and leave the vnode_zone. With this change the
initializations are only done kern.maxvnodes times at system startup
and then only rarely again. The frees are done only if the vnode_zone
shrinks which never happens in practice. For those curious about the
avoided work, look at the vnode_init() and vnode_fini() functions in
kern/vfs_subr.c to see the code that has been removed from the main
vnode allocation/free path.

Reviewed by: kib
Tested by: Peter Holm

MFC of 291671:
We need to zero out the union of pointers in a freed vnode structure.

Fix from: Mateusz Guzik
Tested by: Jason Unovitch

MFC of 291743:
We need to zero out the clustering variables in a freed vnode structure.
For completeness add a VNASSERT that there are no threads waiting on a
range lock (this was previously checked on every vnode free).

Reported by; Rick Macklem
Fix from: Mateusz Guzik


# 291757 04-Dec-2015 kib

MFC r291379:
Move the comment about resident pages preventing vnode from leaving
active list, into the header comment for vdrop().


# 290396 05-Nov-2015 smh

MFC r273118 (by mjg)

Don't take devmtx unnecessarily in vn_isdisk.

Sponsored by: Multiplay


# 289513 18-Oct-2015 trasz

MFC r287033:

After r286237 it should be fine to call vgone(9) on a busy GEOM vnode;
remove KASSERT that would prevent forced devfs unmount from working.

Sponsored by: The FreeBSD Foundation


# 289510 18-Oct-2015 trasz

MFC r286281:

Mark vgonel() as static.

Sponsored by: The FreeBSD Foundation


# 288410 30-Sep-2015 markj

MFC r288276:
Fix argument ordering in vn_printf().


# 288079 21-Sep-2015 mckusick

MFC of 281677:

More accurately collect name-cache statistics in sysctl functions
sysctl_debug_hashstat_nchash() and sysctl_debug_hashstat_rawnchash().
These changes are in preparation for allowing changes in the size
of the vnode hash tables driven by increases and decreases in the
maximum number of vnodes in the system.

Reviewed by: kib@
Phabric: D2265

MFC of 287497:

Track changes to kern.maxvnodes and appropriately increase or decrease
the size of the name cache hash table (mapping file names to vnodes)
and the vnode hash table (mapping mount point and inode number to vnode).
An appropriate locking strategy is the key to changing hash table sizes
while they are in active use.

Reviewed by: kib
Tested by: Peter Holm
Differential Revision: https://reviews.freebsd.org/D2265


# 286397 07-Aug-2015 kib

MFC r285384:
Do not allow creation of the dirty buffers for the dead buffer objects.


# 284993 01-Jul-2015 kib

MFC r284495:
Keep a vnode which is freed but still owing inactivation, on the active list.
This closes a race where such vnode is not msync-ed until reboot.


# 284203 10-Jun-2015 kib

MFC r283602:
Prevent dounmount() from acting on the freed (although type-stable)
memory by changing the interface to require the mount point to be
referenced.

MFC r283629:
Add missed {}.


# 282270 30-Apr-2015 rmacklem

MFC: r281562
File systems that do not use the buffer cache (such as ZFS) must
use VOP_FSYNC() to perform the NFS server's Commit operation.
This patch adds a mnt_kern_flag called MNTK_USES_BCACHE which
is set by file systems that use the buffer cache. If this flag
is not set, the NFS server always does a VOP_FSYNC().
This should be ok for old file system modules that do not set
MNTK_USES_BCACHE, since calling VOP_FSYNC() is correct, although
it might not be optimal for file systems that use the buffer cache.


# 280912 31-Mar-2015 jhb

MFC 278760:
Add two new counters for vnode life cycle events:
- vfs.recycles counts the number of vnodes forcefully recycled to avoid
exceeding kern.maxvnodes.
- vfs.vnodes_created counts the number of vnodes created by successful
calls to getnewvnode().


# 279848 10-Mar-2015 jhb

MFC 277712:
Change the default VFS timestamp precision from seconds to microseconds.


# 279685 06-Mar-2015 kib

MFC r279362:
The VNASSERT in vflush() FORCECLOSE case is trying to panic early to
prevent errors from yanking devices out from under filesystems. Only
care about special vnodes on devfs, special nodes on other kinds of
filesystems do not have special properties.


# 279495 01-Mar-2015 ngie

MFC r278891:

Add the mnt_lockref field to the ddb(4) 'show mount' command

Differential Revision: https://reviews.freebsd.org/D1688
Submitted by: Conrad Meyer <conrad.meyer@isilon.com>
Sponsored by: EMC / Isilon Storage Division


# 275956 20-Dec-2014 kib

MFC r275743:
Put the buffer cleanup code after inactivation.


# 275798 15-Dec-2014 kib

MFC r275620:
Add functions syncer_suspend() and syncer_resume().

MFC r275637:
Remove local variable for real.


# 270095 17-Aug-2014 kib

MFC r269457:
Remove Giant acquisition from the mount and unmount pathes.


# 269562 05-Aug-2014 kib

MFC r269244:
Remove one-time use macros which check for the vnode lifecycle.


# 267749 22-Jun-2014 mav

MFC r267392:
Implement simple direct-mapped cache for popular filesystem identifiers to
avoid congestion on global mountlist_mtx mutex in vfs_busyfs(), while
traversing through the list of mount points.

This change significantly improves NFS server scalability, since it had
to do this translation for every request, and the global lock becomes quite
congested.

This code is more optimized for relatively small number of mount points.
On systems with hundreds of active mount points this simple cache may have
many collisions. But the original traversal code in that case should also
behave much worse, so we are not loosing much.


# 267748 22-Jun-2014 mav

MFC r267362:
Remove unneeded mountlist_mtx acquisition from sync_fsync().

All struct mount fields accessed by sync_fsync() are protected by MNT_MTX.


# 267743 22-Jun-2014 mav

MFC r267232, r267239:
Use atomics to modify numvnodes variable.

This allows to mostly avoid lock usage in getnewvnode_[drop_]reserve(),
that reduces number of global vnode_free_list_mtx mutex acquisitions
from 4 to 2 per NFS request on ZFS, improving SMP scalability.


# 288410 30-Sep-2015 markj

MFC r288276:
Fix argument ordering in vn_printf().


# 288079 21-Sep-2015 mckusick

MFC of 281677:

More accurately collect name-cache statistics in sysctl functions
sysctl_debug_hashstat_nchash() and sysctl_debug_hashstat_rawnchash().
These changes are in preparation for allowing changes in the size
of the vnode hash tables driven by increases and decreases in the
maximum number of vnodes in the system.

Reviewed by: kib@
Phabric: D2265

MFC of 287497:

Track changes to kern.maxvnodes and appropriately increase or decrease
the size of the name cache hash table (mapping file names to vnodes)
and the vnode hash table (mapping mount point and inode number to vnode).
An appropriate locking strategy is the key to changing hash table sizes
while they are in active use.

Reviewed by: kib
Tested by: Peter Holm
Differential Revision: https://reviews.freebsd.org/D2265


# 286397 07-Aug-2015 kib

MFC r285384:
Do not allow creation of the dirty buffers for the dead buffer objects.


# 284993 01-Jul-2015 kib

MFC r284495:
Keep a vnode which is freed but still owing inactivation, on the active list.
This closes a race where such vnode is not msync-ed until reboot.


# 284203 10-Jun-2015 kib

MFC r283602:
Prevent dounmount() from acting on the freed (although type-stable)
memory by changing the interface to require the mount point to be
referenced.

MFC r283629:
Add missed {}.


# 282270 30-Apr-2015 rmacklem

MFC: r281562
File systems that do not use the buffer cache (such as ZFS) must
use VOP_FSYNC() to perform the NFS server's Commit operation.
This patch adds a mnt_kern_flag called MNTK_USES_BCACHE which
is set by file systems that use the buffer cache. If this flag
is not set, the NFS server always does a VOP_FSYNC().
This should be ok for old file system modules that do not set
MNTK_USES_BCACHE, since calling VOP_FSYNC() is correct, although
it might not be optimal for file systems that use the buffer cache.


# 280912 31-Mar-2015 jhb

MFC 278760:
Add two new counters for vnode life cycle events:
- vfs.recycles counts the number of vnodes forcefully recycled to avoid
exceeding kern.maxvnodes.
- vfs.vnodes_created counts the number of vnodes created by successful
calls to getnewvnode().


# 279848 10-Mar-2015 jhb

MFC 277712:
Change the default VFS timestamp precision from seconds to microseconds.


# 279685 06-Mar-2015 kib

MFC r279362:
The VNASSERT in vflush() FORCECLOSE case is trying to panic early to
prevent errors from yanking devices out from under filesystems. Only
care about special vnodes on devfs, special nodes on other kinds of
filesystems do not have special properties.


# 279495 01-Mar-2015 ngie

MFC r278891:

Add the mnt_lockref field to the ddb(4) 'show mount' command

Differential Revision: https://reviews.freebsd.org/D1688
Submitted by: Conrad Meyer <conrad.meyer@isilon.com>
Sponsored by: EMC / Isilon Storage Division


# 275956 20-Dec-2014 kib

MFC r275743:
Put the buffer cleanup code after inactivation.


# 275798 15-Dec-2014 kib

MFC r275620:
Add functions syncer_suspend() and syncer_resume().

MFC r275637:
Remove local variable for real.


# 270095 17-Aug-2014 kib

MFC r269457:
Remove Giant acquisition from the mount and unmount pathes.


# 269562 05-Aug-2014 kib

MFC r269244:
Remove one-time use macros which check for the vnode lifecycle.


# 267749 22-Jun-2014 mav

MFC r267392:
Implement simple direct-mapped cache for popular filesystem identifiers to
avoid congestion on global mountlist_mtx mutex in vfs_busyfs(), while
traversing through the list of mount points.

This change significantly improves NFS server scalability, since it had
to do this translation for every request, and the global lock becomes quite
congested.

This code is more optimized for relatively small number of mount points.
On systems with hundreds of active mount points this simple cache may have
many collisions. But the original traversal code in that case should also
behave much worse, so we are not loosing much.


# 267748 22-Jun-2014 mav

MFC r267362:
Remove unneeded mountlist_mtx acquisition from sync_fsync().

All struct mount fields accessed by sync_fsync() are protected by MNT_MTX.


# 267743 22-Jun-2014 mav

MFC r267232, r267239:
Use atomics to modify numvnodes variable.

This allows to mostly avoid lock usage in getnewvnode_[drop_]reserve(),
that reduces number of global vnode_free_list_mtx mutex acquisitions
from 4 to 2 per NFS request on ZFS, improving SMP scalability.