commit 7484877bdb34db97bc684ab26e9fc606f5b1f0b7
Author: Mateusz Guzik <mjg@FreeBSD.org>
Date: Mon Dec 19 13:00:30 2022 +0000vfs: add the concept of vnode state transitions To quote from a comment above vput_final: <quote> * XXX Some filesystems pass in an exclusively locked vnode and strongly depend * on the lock being held all the way until VOP_INACTIVE. This in particular * happens with UFS which adds half-constructed vnodes to the hash, where they * can be found by other code. </quote> As is there is no mechanism which allows filesystems to denote that a vnode is fully initialized, consequently problems like the above are only found the hard way(tm). Add rudimentary support for state transitions, which in particular allow to assert the vnode is not legally unlocked until its fate is decided (either construction finishes or vgone is called to abort it). The new field lands in a 1-byte hole, thus it does not grow the struct. Reviewed by: Differential Revision:commit 05108b1829e98572488a45b2e8352eb81204caaa
Author: Mateusz Guzik <mjg@FreeBSD.org>
Date: Mon Dec 19 14:42:04 2022 +0000mntfs: change mntfs_allocvp API to relock on its own Reviewed by: Differential Revision:commit bf20666b84a806f964058be04fdbb9b8b62bf646
Author: Mateusz Guzik <mjg@FreeBSD.org>
Date: Thu Dec 22 13:37:17 2022 +0000vfs: use designated initializers for the typename array While here prefix with v for better consistency with the vnode stuff. Reviewed by: Differential Revision:
Details
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
I wished we have a way to make an assert that specific region of code does not drop and reacquire a specific lock. It is often useful when it is impossible to completely trace all calls from the top layer, to ensure that the protected state is still consistent. One example of (complicated) use of this feature is the ffs_lock()/ffs_unlock()/ffs_unlock_tracker(), where it asserts that the directory lookup state is still under the same lock ownership.
Your vnode state tracking is very similar, and in some cases does just that.
sys/kern/vfs_subr.c | ||
---|---|---|
4149 | It should be 4 spaces in indent (or tab). | |
5723 | I do not think the blank line is needed. |