Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

CORTX-33564: Fixed panic in rpc_session_cancelled() due to session state #1969

Merged
merged 4 commits into from
Jul 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions rpc/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -851,12 +851,16 @@ M0_INTERNAL void m0_rpc_session_cancel(struct m0_rpc_session *session)
{
struct m0_rpc_item *item;

M0_PRE(session->s_session_id != SESSION_ID_0);
M0_PRE(M0_IN(session_state(session),
(M0_RPC_SESSION_BUSY, M0_RPC_SESSION_IDLE)));

M0_ENTRY("session %p", session);

M0_PRE(session->s_session_id != SESSION_ID_0);
m0_rpc_machine_lock(session->s_conn->c_rpc_machine);
if (!M0_IN(session_state(session),
ivan-alekhin marked this conversation as resolved.
Show resolved Hide resolved
(M0_RPC_SESSION_BUSY, M0_RPC_SESSION_IDLE))) {
M0_LEAVE("session %p state=%d", session, session_state(session));
m0_rpc_machine_unlock(session->s_conn->c_rpc_machine);
return;
}
if (session->s_cancelled)
goto leave_unlock;
session->s_cancelled = true;
Expand All @@ -868,7 +872,6 @@ M0_INTERNAL void m0_rpc_session_cancel(struct m0_rpc_session *session)
leave_unlock:
m0_rpc_machine_unlock(session->s_conn->c_rpc_machine);
M0_POST(pending_item_tlist_is_empty(&session->s_pending_cache));
M0_POST(session->s_sm.sm_state == M0_RPC_SESSION_IDLE);
M0_LEAVE("session %p", session);
madhavemuri marked this conversation as resolved.
Show resolved Hide resolved
}

Expand Down