[Cluster-devel] [PATCH] gfs2: Add missing rcu locking for glock lookup

Steven Whitehouse swhiteho at redhat.com
Wed Feb 22 15:50:45 UTC 2017


Hi,


On 22/02/17 15:34, Andreas Gruenbacher wrote:
> On Wed, Feb 22, 2017 at 4:29 PM, Steven Whitehouse <swhiteho at redhat.com> wrote:
>> There should be no need to retry at all. Either the new entry will be added
>> to the hash table, or it will find an existing entry in the table. Is there
>> really some way this can fail for some reason?
> Yes, we may find an existing entry but by the time we try to get a
> lockref, the entry may be dead. In that case, the right thing to do is
> to retry the insert.
>
> Andreas

Hmm. If it is dead but not yet removed from the list, then we will spin 
on this. The original code prior to the rhashtable conversion would have 
just looked at the next entry on the list, if it found a dead entry matching
the key.

In gfs2_glock_put() we do remove the glock from the hash table, but not 
until after removing it from the lru and dropping the gl_lockref.lock, 
so there is some potential for this to happen. Whether it will be a 
problem in reality I'm not sure, but it is not ideal - I wonder how 
other rhashtable users deal with this issue... or maybe we are the only 
ones using lockref with rhashtable.

This is certainly a big improvement on what we had before, but at the 
same time, we should make a note to fix this properly in due course,

Steve.




More information about the Cluster-devel mailing list