Re: Various unprotected accesses to buf and vnode

From: Alexander Lochmann <alexander.lochmann_at_tu-dortmund.de>
Date: Tue, 31 Aug 2021 08:59:26 UTC
On 29.08.21 00:29, Konstantin Belousov wrote:
> Ok, I see some call sequences (?), but again all of them are ffs_write()
> (one is ext2_write) calling into cluster_write().  There the buffer lock
> is owned.
> 
> Show me the specific call sequence where it is not.
Who owns the buffer lock at that point? Has its ownership been
transferred to the kernel?
Do you know where the buffer lock is acquired?

According to our data, the buffer lock of the current accessed buffer is
not owned. Otherwise, there would an entry like this
'EMBSAME(buf.b_lock[w])'.
So in all of those call sequences the buffer lock is not acquired.
However, I'd not rule out that our tooling could be broken as well.

> Ah, yes, the calls from lookup and open would be with the shared lock.
> Still, we lock the vnode interlock to avoid double-allocating the v_object
> object, so it is fine.  Some mode of the vnode lock is required nonetheless,
> because otherwise we might miss reclaim which guarantees that v_object 
> is freed.
> 
I see. Does this rule apply to all fields for which the vnode lock is
the designated lock?
From a different angle:
The documentation says about bo_object: ''v' is the vnode lock which
embeds the bufobj.'.
Does 'the vnode lock' mean a specific lock, or a group of locks?

-- 
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