Tidy earlier fix and apply another - both follow the principle of not removing the link from session to client DCB when dcb_close is called for client DCB. The close will not fully complete, but will be finalised when the session is freed. At this time, no DCBs will be referring to the session. These measures protect the dcb->data in the client DCB from being lost until the session is no longer needed.
This commit is contained in:
@ -366,19 +366,6 @@ dcb_final_free(DCB *dcb)
|
|||||||
SESSION *local_session = dcb->session;
|
SESSION *local_session = dcb->session;
|
||||||
dcb->session = NULL;
|
dcb->session = NULL;
|
||||||
CHK_SESSION(local_session);
|
CHK_SESSION(local_session);
|
||||||
/**
|
|
||||||
* Set session's client pointer NULL so that other threads
|
|
||||||
* won't try to call dcb_close for client DCB
|
|
||||||
* after this call.
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
if (local_session->client_dcb == dcb)
|
|
||||||
{
|
|
||||||
spinlock_acquire(&local_session->ses_lock);
|
|
||||||
local_session->client_dcb = NULL;
|
|
||||||
spinlock_release(&local_session->ses_lock);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (SESSION_STATE_DUMMY != local_session->state)
|
if (SESSION_STATE_DUMMY != local_session->state)
|
||||||
{
|
{
|
||||||
session_free(local_session);
|
session_free(local_session);
|
||||||
|
@ -1166,9 +1166,7 @@ static int gw_backend_close(DCB *dcb)
|
|||||||
spinlock_release(&session->ses_lock);
|
spinlock_release(&session->ses_lock);
|
||||||
|
|
||||||
/** Close client DCB */
|
/** Close client DCB */
|
||||||
temp = session->client_dcb;
|
dcb_close(session->client_dcb);
|
||||||
session->client_dcb = NULL;
|
|
||||||
dcb_close(temp);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user