Frank Filz has uploaded this change for review.

View Change

Change hold_state_owner to use atomic_inc_unless_0_int32_t

Also change the name to hold_state_owner_ref (which makes it easier to
audit code for proper use of refcounts).

By using atomic_inc_unless_0_int32_t, we can detect the case where the
refcount is already 0, so rather than trying to process this owner we
skip it (for now). This means that hold_state_owner_ref doesn't need to
take the hash latch (which caused a lock order inversion) to protect
while we check for 0 refcount.

This lock inversion was introduced in commit
c8e18281a4cf0b535f731cf0fcd0dcc5566c2ef0 as an attempt to avoid the
incrementing refcount from 0.

This addresses the deadlock caused by the lock inversion reported in
github issue #934.

Change-Id: Ia3babaad97a3e430091dc3b23e6e21d095418ac2
Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
---
M src/SAL/nfs4_clientid.c
M src/SAL/state_misc.c
M src/include/sal_functions.h
3 files changed, 49 insertions(+), 47 deletions(-)

git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/34/553234/1

To view, visit change 553234. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: ffilz/nfs-ganesha
Gerrit-Branch: next
Gerrit-Change-Id: Ia3babaad97a3e430091dc3b23e6e21d095418ac2
Gerrit-Change-Number: 553234
Gerrit-PatchSet: 1
Gerrit-Owner: Frank Filz <ffilzlnx@mindspring.com>
Gerrit-MessageType: newchange