Skip to content
Commit e8568739 authored by Jeff Layton's avatar Jeff Layton Committed by J. Bruce Fields
Browse files

nfsd: ensure that the ol stateid hash reference is only put once



When an open or lock stateid is hashed, we take an extra reference to
it. When we unhash it, we drop that reference. The code however does
not properly account for the case where we have two callers concurrently
trying to unhash the stateid. This can lead to list corruption and the
hash reference being put more than once.

Fix this by having unhash_ol_stateid use list_del_init on the st_perfile
list_head, and then testing to see if that list_head is empty before
releasing the hash reference. This means that some of the unhashing
wrappers now become bool return functions so we can test to see whether
the stateid was unhashed before we put the reference.

Reported-by: default avatarAndrew W Elble <aweits@rit.edu>
Tested-by: default avatarAndrew W Elble <aweits@rit.edu>
Reported-by: default avatarAnna Schumaker <Anna.Schumaker@netapp.com>
Tested-by: default avatarAnna Schumaker <Anna.Schumaker@netapp.com>
Signed-off-by: default avatarJeff Layton <jeff.layton@primarydata.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 051ac384
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment