Jim Chen has uploaded this change for review.

View Change

SAL: fix cross-client revocation checks and free mismatch in state_deleg

In src/SAL/state_deleg.c:
1. has_revoked_delegations_for_client() iterates over the global
revoked_delegations_list and unconditionally sets found = true on the
first entry without comparing the entry's clientid prefix in
stateid.other against clientid->cid_clientid. A single revoked
delegation on one client causes all other clients to appear as having
revoked delegations.
2. atomic_remove_revoked_and_clear_flags() checks
!glist_empty(&revoked_delegations_list) globally instead of checking
whether any remaining revoked delegations belong to clientid. When
another client still has a revoked delegation, a client calling
FREE_STATEID never has its session has_revoked_delegations flag
cleared and remains stuck in a SEQ4_STATUS_RECALLABLE_STATE_REVOKED
recovery loop.
3. remove_revoked_stateid() frees entries allocated via
gsh_malloc(sizeof(*entry), MEM_COMP_STATE) using raw libc free(entry)
instead of gsh_free(entry, MEM_COMP_STATE).

Filter revoked_delegations_list entries by clientid->cid_clientid in both
has_revoked_delegations_for_client() and
atomic_remove_revoked_and_clear_flags(), guard against a NULL clientid,
and use gsh_free(entry, MEM_COMP_STATE) in remove_revoked_stateid().

Change-Id: I344ec08d371c7ba58790f936e4fa8d6f62e1c053
Signed-off-by: Jim Chen <czcbangkai@google.com>
---
M src/SAL/state_deleg.c
1 file changed, 27 insertions(+), 6 deletions(-)

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

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

Gerrit-MessageType: newchange
Gerrit-Project: ffilz/nfs-ganesha
Gerrit-Branch: next
Gerrit-Change-Id: I344ec08d371c7ba58790f936e4fa8d6f62e1c053
Gerrit-Change-Number: 1257474
Gerrit-PatchSet: 1
Gerrit-Owner: Jim Chen <czcbangkai@google.com>