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
F101937185: D23530.id68160.diff
Tue, Nov 5, 4:28 PM
Unknown Object (File)
Sep 21 2024, 10:09 PM
Unknown Object (File)
Sep 19 2024, 3:08 PM
Unknown Object (File)
Sep 17 2024, 8:02 AM
Unknown Object (File)
Sep 17 2024, 2:49 AM
Unknown Object (File)
Sep 16 2024, 2:01 PM
Unknown Object (File)
Sep 15 2024, 6:31 PM
Unknown Object (File)
Sep 7 2024, 5:21 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 29199

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

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

3327

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

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

vrele()
decr v_usecount

2812

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

2817

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.