Various unprotected accesses to buf and vnode

From: Alexander Lochmann <>
Date: Fri, 27 Aug 2021 15:48:38 +0200
Hi folks,

I'm still analyzing our LockDoc (lock analysis) data for FreeBSD. I came 
across accesses that do not adhere to the locking documentation. I 
cannot tell whether these accesses are made deliberately without locks 
or not.
I listed them below.

Can you please shed some light on those cases?

Thx and regards,

- Write to buf.b_error without buf.b_lock:

- Read of buf.b_blkno in cluster_write():
According to the documentation b_lock is needed.
Is b_blkno maybe a read-only element of struct buf?

- Read of buf.b_flags, buf.b_xflags and buf.b_vp:
Are those reads innocent races?
According to our data, buf.b_lock is not acquired.

- Write to vnode.v_bufobj.bo_object:
According to the documentation, '[...] the vnode lock which embeds the 
bufobj' is needed. However, interlock is taken in line 276.
Is the interlock equivalent to the vnode lock?
(I assume 'the vnode lock' refers to vnode.v_lock.)

- Is buf.b_bufobj a read-only element?

Technische Universit├Ąt Dortmund
Alexander Lochmann                PGP key: 0xBC3EF6FD
Otto-Hahn-Str. 16                 phone:  +49.231.7556141
D-44227 Dortmund                  fax:    +49.231.7556116
Received on Fri Aug 27 2021 - 13:48:38 UTC

Original text of this message