[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <293dff44-8ae2-431b-a002-b31a09ddd34e@acm.org>
Date: Fri, 12 Jul 2024 10:53:28 -0700
From: Bart Van Assche <bvanassche@....org>
To: Ming Lei <ming.lei@...hat.com>
Cc: YangYang <yang.yang@...o.com>, Andrew Morton <akpm@...ux-foundation.org>,
Jens Axboe <axboe@...nel.dk>, Omar Sandoval <osandov@...com>,
linux-kernel@...r.kernel.org, linux-block@...r.kernel.org
Subject: Re: [PATCH v6] sbitmap: fix io hung due to race on
sbitmap_word::cleared
On 7/11/24 6:01 PM, Ming Lei wrote:
> On Fri, Jul 12, 2024 at 12:33 AM Bart Van Assche <bvanassche@....org> wrote:
>> The comment above 'swap_lock' in this patch is as follows:
>>
>> /**
>> * @swap_lock: Held while swapping word <-> cleared
>> */
>>
>> In other words, 'swap_lock' is used to serialize *code*. Using
>> synchronization objects to serialize code is known as an anti-pattern,
>> something that shouldn't be done.
>
>> Synchronization objects should be used
>> to serialize access to data.
>
> It can be thought of serializing UPDATE on both ->word and ->cleared,
> instead of code.
It would be appreciated if the comment above swap_lock would be modified
such that it reflects that it serializes simultaneous updates of ->word
and ->cleared.
Thanks,
Bart.
Powered by blists - more mailing lists