osi_Log2(smb_logp, "marking dead vcp 0x%x, user struct 0x%x",
vcp, vcp->usersp);
- lock_ObtainWrite(&smb_globalLock);
lock_ObtainMutex(&vcp->mx);
vcp->flags |= SMB_VCFLAG_ALREADYDEAD;
- dead_sessions[vcp->session] = TRUE;
lock_ReleaseMutex(&vcp->mx);
+ lock_ObtainWrite(&smb_globalLock);
+ dead_sessions[vcp->session] = TRUE;
lock_ReleaseWrite(&smb_globalLock);
smb_CleanupDeadVC(vcp);
}
/* Client closed session */
vcp = smb_FindVC(ncbp->ncb_lsn, 0, lanas[idx_session]);
if (vcp) {
- lock_ObtainWrite(&smb_globalLock);
+ 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);
- lock_ObtainMutex(&vcp->mx);
vcp->flags |= SMB_VCFLAG_ALREADYDEAD;
- dead_sessions[vcp->session] = TRUE;
lock_ReleaseMutex(&vcp->mx);
+ lock_ObtainWrite(&smb_globalLock);
+ dead_sessions[vcp->session] = TRUE;
lock_ReleaseWrite(&smb_globalLock);
smb_CleanupDeadVC(vcp);
smb_ReleaseVC(vcp);
vcp = NULL;
- }
+ } else {
+ lock_ReleaseMutex(&vcp->mx);
+ }
}
goto doneWithNCB;
default:
/* A weird error code. Log it, sleep, and continue. */
vcp = smb_FindVC(ncbp->ncb_lsn, 0, lanas[idx_session]);
+ if (vcp)
+ lock_ObtainMutex(&vcp->mx);
if (vcp && vcp->errorCount++ > 3) {
osi_Log2(smb_logp, "session [ %d ] closed, vcp->errorCount = %d", idx_session, vcp->errorCount);
- lock_ObtainWrite(&smb_globalLock);
if (!(vcp->flags & SMB_VCFLAG_ALREADYDEAD)) {
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;
- dead_sessions[vcp->session] = TRUE;
lock_ReleaseMutex(&vcp->mx);
+ lock_ObtainWrite(&smb_globalLock);
+ dead_sessions[vcp->session] = TRUE;
lock_ReleaseWrite(&smb_globalLock);
smb_CleanupDeadVC(vcp);
smb_ReleaseVC(vcp);
vcp = NULL;
- }
+ } else {
+ lock_ReleaseMutex(&vcp->mx);
+ }
goto doneWithNCB;
}
else {
+ if (vcp)
+ lock_ReleaseMutex(&vcp->mx);
thrd_Sleep(1000);
- thrd_SetEvent(SessionEvents[idx_session]);
+ thrd_SetEvent(SessionEvents[idx_session]);
}
- continue;
+ continue;
}
/* Success, so now dispatch on all the data in the packet */
unp = uidp->unp;
lock_ReleaseMutex(&uidp->mx);
+#ifdef COMMENT
+ /* we can't do this. we get logoff messages prior to a session
+ * disconnect even though it doesn't mean the user is logging out.
+ * we need to create a new pioctl and EventLogoff handler to set
+ * SMB_USERNAMEFLAG_LOGOFF.
+ */
if (unp && smb_LogoffTokenTransfer) {
lock_ObtainMutex(&unp->mx);
unp->flags |= SMB_USERNAMEFLAG_LOGOFF;
unp->last_logoff_t = osi_Time() + smb_LogoffTransferTimeout;
lock_ReleaseMutex(&unp->mx);
}
+#endif
smb_ReleaseUID(uidp);
}
return tp;
}
-/* free a tran2 packet; must be called with smb_globalLock held */
+/* free a tran2 packet */
void smb_FreeTran2Packet(smb_tran2Packet_t *t2p)
{
if (t2p->vcp) {
}
/* free the input tran 2 packet */
- lock_ObtainWrite(&smb_globalLock);
smb_FreeTran2Packet(asp);
- lock_ReleaseWrite(&smb_globalLock);
}
else if (firstPacket) {
/* the first packet in a multi-packet request, we need to send an
}
/* free the input tran 2 packet */
- lock_ObtainWrite(&smb_globalLock);
smb_FreeTran2Packet(asp);
- lock_ReleaseWrite(&smb_globalLock);
}
else if (firstPacket) {
/* the first packet in a multi-packet request, we need to send an