Page MenuHomeFreeBSD

3/3 vfs: refactor vputx and add more comments
ClosedPublic

Authored by mjg on Feb 6 2020, 12:20 AM.
Tags
None
Referenced Files
F132481857: D23530.id67846.diff
Fri, Oct 17, 7:12 AM
F132464541: D23530.diff
Fri, Oct 17, 3:56 AM
Unknown Object (File)
Sun, Oct 5, 1:51 AM
Unknown Object (File)
Sat, Oct 4, 2:38 PM
Unknown Object (File)
Thu, Sep 25, 3:51 AM
Unknown Object (File)
Mon, Sep 22, 9:13 AM
Unknown Object (File)
Sep 3 2025, 1:02 PM
Unknown Object (File)
Aug 28 2025, 1:39 AM
Subscribers

Details

Summary

the vnode interlock relocking for vchr in vrele may seem problematic, but it almost never happens in practice. I take it for readability.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mjg retitled this revision from vfs: refactor vputx and add more comments to 3/3 vfs: refactor vputx and add more comments.Feb 6 2020, 12:20 AM
mjg edited the summary of this revision. (Show Details)
sys/kern/vfs_subr.c
3200 ↗(On Diff #67846)

Can we rename this vput_final or vput_last or something. At first glance it was confusing to me for historical reasons.

3327 ↗(On Diff #67846)

It's not clear to me why all of the release routines don't have this VCHR code.

sys/kern/vfs_subr.c
2802–2804 ↗(On Diff #67846)

The caller is required to hold the interlock when transitioning a VCHR usecount to zero. This prevents a race with devfs_reclaim_vchr() that would leak a si_usecount reference. The vnode lock will also prevent this race if it is held while dropping the last ref.

2810 ↗(On Diff #67846)

vrele()
decr v_usecount

2812 ↗(On Diff #67846)

v_usecount == 0, does not decrement si_usecount
v_rdev = NULL

2817 ↗(On Diff #67846)

v_decr_devcount()
v_dev == NULL, does not decrement si_usecount

This revision is now accepted and ready to land.Feb 12 2020, 4:16 AM
This revision was automatically updated to reflect the committed changes.