deepakarumugam.s@nutanix.com has uploaded this change for review.
Multi-client same hostname issue - open owner refcount fix
This is a followup to
https://review.gerrithub.io/c/ffilz/nfs-ganesha/+/553234
Issue/Bug:
After cherry-picking the changes our code flow for
creating a nfs4 open owner looks like this
(1) owner.refcount = 1
(memcpy from key to owner accomplishes this)
(2) mutex_lock(clid_mutex)
add owner to clid_list
mutex_unlock(clid_mutex)
(3) owner.refcount = 1 (again)
The problem is when the client id expiration code
gets interleaved between (2) and (3) it does
something like this,
mutex_lock(clid_mutex)
atomic_inc(owner.refcount) // value goes up to 2
mutex_unlock(clid_mutex)
Now when step (3) gets executed after the
client id expiration code it resets refcount
from 2 to 1.
This causes unnecessary freeing of open_owner
structures and lots of crashes segfaults etc.
Solution:
We remove (3) (ie) resetting refcount to 1
after adding it to the list.
This code is also used for nlm owner
initializations. nlm code assumes that
get_state_owner takes care of the refcount
so now we have to take care of the refcount
in nlm callback
Change-Id: I8ed40adee9b60fb3101aafb1b675c7c782a1f640
Signed-off-by: Deepak Arumugam Sankara Subramanian <deepakarumugam.s@nutanix.com>
---
M src/SAL/nlm_owner.c
M src/SAL/state_misc.c
2 files changed, 50 insertions(+), 2 deletions(-)
git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/39/553739/1
To view, visit change 553739. To unsubscribe, or for help writing mail filters, visit settings.