Re: Various unprotected accesses to buf and vnode

From: Alexander Lochmann <alexander.lochmann_at_tu-dortmund.de>
Date: Thu, 02 Sep 2021 07:34:39 UTC

On 02.09.21 06:16, Konstantin Belousov wrote:
> Ah, it is bp->b_blkno access after the b*write() functions were called
> to write out and release the buffer, right.  I put the patch to fix this
> into https://reviews.freebsd.org/D31780
> 
> Please remind me what attributions to use for 'Reported by:' tagline.
Last time it was '[...] issue was reported by	Alexander Lochmann
<alexander.lochmann@tu-dortmund.de>, who found the problem by performing
lock analysis using LockDoc, see https://doi.org/10.1145/3302424.3303948.'
> 
>>> Read e.g. sys/ufs/ufs/inode.h gerald comment above struct inode definition.
>>> It provides more detailed exposure.
>> Aaah. Thx. This is about the struct inode. So I assume it also applies
>> for a vnode belonging to an inode. Am I right?> Vnode lock is a lock
>> obtained with vn_lock().  It is up to filesystem
> When needed, yes, it is a reasonable locking strategy.  But I am not
> sure that we actually use for any of the struct vnode fields proper,
> Something closer to it is for v_writecount, but formally it is under the
> vnode interlock.  Although I do not think we ever modify it without holding
> vnode lock, in some mode.
Can this locking strategy be applied to a vnode for any other 
filesystem, ntfs for example?
If so: Shouldn't it be written down in vnode.h?

-- 
Technische Universität Dortmund
Alexander Lochmann                PGP key: 0xBC3EF6FD
Otto-Hahn-Str. 16                 phone:  +49.231.7556141
D-44227 Dortmund                  fax:    +49.231.7556116
http://ess.cs.tu-dortmund.de/Staff/al