[struct buf] Unlocked access to b_vflags?

Alexander Lochmann alexander.lochmann at tu-dortmund.de
Mon Apr 12 21:19:10 UTC 2021

Hi folks,

I'm was digging through our data set when I encountered a strange situation:
According to the code in trunc_dependencies() in sys/ufs/ffs/ffs_softdep.c,
the bo_lock should be held. At least that's how I read the code.
However, we see several thousands of accesses to b_vflags without the 
bo_lock held.
At least the own b_lock is acquired.
The access happens in line 7549: bp->b_vflags |= BV_SCANNED; [1]
Can you please shed some light on this situation?
Is the b_lock sufficeint, and somehow overrules the bo_lock?
Am I missing something?

FYI, some information about the greater context: I'm still trying to 
understand FreeBSD's locking. This is needed to properly port our 
approach. LockDoc, at the moment, seems to miss some cases on FreeBSD.


Technische Universität Dortmund
Alexander Lochmann                PGP key: 0xBC3EF6FD
Otto-Hahn-Str. 16                 phone:  +49.231.7556141
D-44227 Dortmund                  fax:    +49.231.7556116

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20210412/c366d9e6/attachment.sig>

More information about the freebsd-fs mailing list