mirror of
https://git.openafs.org/openafs.git
synced 2025-01-31 21:47:45 +00:00
DEVEL15-windows-smb-vcp-cleanup-races-20060511
Only allow one thread to mark the vcp dead (cherry picked from commit f6833e96f961de1c1d402646c87681f27bf926e9)
This commit is contained in:
parent
3a518fb146
commit
92c2d265cd
@ -2525,16 +2525,19 @@ void smb_SendPacket(smb_vc_t *vcp, smb_packet_t *inp)
|
||||
LogEvent(EVENTLOG_WARNING_TYPE, MSG_SMB_SEND_PACKET_FAILURE, s);
|
||||
#endif /* !DJGPP */
|
||||
|
||||
osi_Log2(smb_logp, "marking dead vcp 0x%x, user struct 0x%x",
|
||||
vcp, vcp->usersp);
|
||||
|
||||
lock_ObtainMutex(&vcp->mx);
|
||||
vcp->flags |= SMB_VCFLAG_ALREADYDEAD;
|
||||
lock_ReleaseMutex(&vcp->mx);
|
||||
lock_ObtainWrite(&smb_globalLock);
|
||||
dead_sessions[vcp->session] = TRUE;
|
||||
lock_ReleaseWrite(&smb_globalLock);
|
||||
smb_CleanupDeadVC(vcp);
|
||||
lock_ObtainMutex(&vcp->mx);
|
||||
if (!(vcp->flags & SMB_VCFLAG_ALREADYDEAD)) {
|
||||
osi_Log2(smb_logp, "marking dead vcp 0x%x, user struct 0x%x",
|
||||
vcp, vcp->usersp);
|
||||
vcp->flags |= SMB_VCFLAG_ALREADYDEAD;
|
||||
lock_ReleaseMutex(&vcp->mx);
|
||||
lock_ObtainWrite(&smb_globalLock);
|
||||
dead_sessions[vcp->session] = TRUE;
|
||||
lock_ReleaseWrite(&smb_globalLock);
|
||||
smb_CleanupDeadVC(vcp);
|
||||
} else {
|
||||
lock_ReleaseMutex(&vcp->mx);
|
||||
}
|
||||
}
|
||||
|
||||
if (localNCB)
|
||||
@ -8111,9 +8114,18 @@ void smb_Listener(void *parmp)
|
||||
smb_FreePacket(outp);
|
||||
|
||||
lock_ObtainMutex(&vcp->mx);
|
||||
vcp->flags |= SMB_VCFLAG_ALREADYDEAD;
|
||||
lock_ReleaseMutex(&vcp->mx);
|
||||
smb_CleanupDeadVC(vcp);
|
||||
if (!(vcp->flags & SMB_VCFLAG_ALREADYDEAD)) {
|
||||
osi_Log2(smb_logp, "marking dead vcp 0x%x, user struct 0x%x",
|
||||
vcp, vcp->usersp);
|
||||
vcp->flags |= SMB_VCFLAG_ALREADYDEAD;
|
||||
lock_ReleaseMutex(&vcp->mx);
|
||||
lock_ObtainWrite(&smb_globalLock);
|
||||
dead_sessions[vcp->session] = TRUE;
|
||||
lock_ReleaseWrite(&smb_globalLock);
|
||||
smb_CleanupDeadVC(vcp);
|
||||
} else {
|
||||
lock_ReleaseMutex(&vcp->mx);
|
||||
}
|
||||
} else {
|
||||
/* assert that we do not exceed the maximum number of sessions or NCBs.
|
||||
* we should probably want to wait for a session to be freed in case
|
||||
|
Loading…
x
Reference in New Issue
Block a user