Re: Understanding locking for buf

From: Alexander Lochmann <alexander.lochmann_at_tu-dortmund.de>
Date: Mon, 27 Feb 2023 08:38:47 UTC
On 24.02.23 21:41, Konstantin Belousov wrote:
>> Viewing it from a different angle: Are accesses in g_vfs_done safe because
>> the buf instance is already locked from a global perspective?
>> Hence, other code paths would block on BUF_LOCK().
> geom completion code is the only code that allowed to touch the buffer
> after the ownership was relinguished.
> 
> I believe I already tell that to you: consider the buffer lock after
> LK_KERNPROC as a semaphore and not lock.
Yeah, you already did. I understand it.
When synchronous IO is performed, the LK_KERNPROC thing isn't used. The 
lock is still owned by the context that triggered the IO operation.
Am I right that even in this situation the accesses from g_vfs_done are 
performed?
Can those accesses be considered as valid exceptions of the overall 
locking rule 'use b_lock' since the buf is locked?

- Alex

-- 
Technische Universität Dortmund
Computer Science XII - System Software Group
Alexander Lochmann                PGP key: 0xBC3EF6FD
Otto-Hahn-Str. 16                 phone:  +49.231.7556141
D-44227 Dortmund                  fax:    +49.231.7556116
https://sys.cs.tu-dortmund.de/al