liyinshu has uploaded this change for review.

View Change

Fix crash bcz slot->cached_result is null for replay request

Fix crash bcz slot->cached_result is null for replay request

Reproduce crash as follows:
thread1: receive a replay request, and found slot->cached_result not
null, assign slot to data->slot at nfs4_op_sequence.c:131,
and unlock the slot->lock.
thread2: receive a normal request, got slot->lock and
release_slot(slot), so slot->cached_result was set null.
thread1: in complete_op, assign *status with
data->slot->cached_result->status,
but data->slot->cached_result is null, so crash happens.

To fix crash, move the code which need slot->cached_result from
complete_op to nfs4_op_sequence, so thread1 can visit cached_result
with the guard of slot->lock. Besides, we need to save cached_result's
status in compound_data, so complete_op can get it.

Change-Id: Ib186774b85c9bb5c31bf5269d1f2adfd1b297f5d
Signed-off-by: liyinshu <liyinshu@bytedance.com>
---
M src/Protocols/NFS/nfs4_Compound.c
M src/Protocols/NFS/nfs4_op_sequence.c
M src/include/nfs_proto_data.h
3 files changed, 46 insertions(+), 11 deletions(-)

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

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

Gerrit-Project: ffilz/nfs-ganesha
Gerrit-Branch: next
Gerrit-Change-Id: Ib186774b85c9bb5c31bf5269d1f2adfd1b297f5d
Gerrit-Change-Number: 542223
Gerrit-PatchSet: 1
Gerrit-Owner: liyinshu <liyinshu@bytedance.com>
Gerrit-MessageType: newchange