Re: Understanding locking for buf

From: Alexander Lochmann <alexander.lochmann_at_tu-dortmund.de>
Date: Mon, 20 Mar 2023 10:25:30 UTC

On 16.03.23 12:24, Konstantin Belousov wrote:
>> Is the following correct?
>> The aforementioned accesses by 100033 in g_vfs_done() are no violations with
>> respect to the locking rule because from a global perspective the buf is
>> locked. It is the only concurrent access at that moment.
> I would formulate it differently:
>    No other thread might legitimately get access to the buffer using
>    either bread() or getblk() until current io operation finishes.
>    The io operation is handled in two contexts: top-level, where a thread
>    used getblk() as usual to claim buffer ownership, and completion
>    thread context (geom up thread). The completion code legitimately
>    manipulates the buffer, because the top-level code expects that after
>    the buffer strategy routine is called, effectively moving the ownership
>    to the geom up thread.
Thx. But the top-level thread, using getblk(), legitimately releases the 
lock. Am I right?

- 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