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
F135373880: D23530.id68168.diff
Sun, Nov 9, 5:49 AM
F135366229: D23530.id.diff
Sun, Nov 9, 4:05 AM
F135329093: D23530.id67846.diff
Sat, Nov 8, 7:28 PM
Unknown Object (File)
Mon, Nov 3, 12:53 PM
Unknown Object (File)
Mon, Nov 3, 12:53 PM
Unknown Object (File)
Mon, Nov 3, 12:53 PM
Unknown Object (File)
Mon, Nov 3, 12:52 PM
Unknown Object (File)
Mon, Nov 3, 12:51 PM
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.