Sachin Punadikar has uploaded this change for review.

View Change

Avoid ABBA kind deadlock while IP release in grace period

During IP release event ABBA deadlock situation ariases as below.
In case of IP release event, nfs4_start_grace (grace_mutex already
locked) calls nfs_release_v4_client. In this it gets the list of
confirmed client records associated with that IP. It travels that
list and attempts to grab lock on client_record->cr_mutex.
Now in parallel, there was a new client approaching Ganesha for the
IP to be released. As part of response to SETCLIENTID_CONFIRM,
nfs4_op_setclientid_confirm, gets the unconfirmed client record, locks
it (client_record->cr_mutex) and after validations, makes it part of
confirmed clients. As next processing it calls nfs4_chk_clid which
needs lock on grace_mutex.
As grace_mutex is for protecting clid_list, the locking can be done
when it is required. This solves this deadlock issue.

Change-Id: Ibdaab87c91b9c78e1b30aa38909032eb7c41f5b6
Signed-off-by: Sachin Punadikar <psachin@in.ibm.com>
---
M src/SAL/nfs4_recovery.c
1 file changed, 5 insertions(+), 7 deletions(-)

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

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

Gerrit-Project: ffilz/nfs-ganesha
Gerrit-Branch: next
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibdaab87c91b9c78e1b30aa38909032eb7c41f5b6
Gerrit-Change-Number: 412321
Gerrit-PatchSet: 1
Gerrit-Owner: Sachin Punadikar <psachin@in.ibm.com>