2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afs/param.h>
20 #include <afs/unified_afs.h>
21 #include <afs/vlserver.h>
22 #include <WINNT/afsreg.h>
24 osi_rwlock_t cm_connLock;
26 DWORD RDRtimeout = CM_CONN_DEFAULTRDRTIMEOUT;
27 unsigned short ConnDeadtimeout = CM_CONN_CONNDEADTIME;
28 unsigned short HardDeadtimeout = CM_CONN_HARDDEADTIME;
29 unsigned short IdleDeadtimeout = CM_CONN_IDLEDEADTIME;
30 unsigned short NatPingInterval = CM_CONN_NATPINGINTERVAL;
32 #define LANMAN_WKS_PARAM_KEY "SYSTEM\\CurrentControlSet\\Services\\lanmanworkstation\\parameters"
33 #define LANMAN_WKS_SESSION_TIMEOUT "SessTimeout"
34 #define LANMAN_WKS_EXT_SESSION_TIMEOUT "ExtendedSessTimeout"
36 afs_uint32 cryptall = 0;
37 afs_uint32 cm_anonvldb = 0;
39 void cm_PutConn(cm_conn_t *connp)
41 afs_int32 refCount = InterlockedDecrement(&connp->refCount);
42 osi_assertx(refCount >= 0, "cm_conn_t refcount underflow");
45 void cm_InitConn(void)
47 static osi_once_t once;
53 if (osi_Once(&once)) {
54 lock_InitializeRWLock(&cm_connLock, "connection global lock",
55 LOCK_HIERARCHY_CONN_GLOBAL);
57 /* keisa - read timeout value for lanmanworkstation service.
59 * http://support.microsoft.com:80/support/kb/articles/Q102/0/67.asp&NoWebContent=1
60 * the SessTimeout is a minimum timeout not a maximum timeout. Therefore,
61 * I believe that the default should not be short. Instead, we should wait until
62 * RX times out before reporting a timeout to the SMB client.
64 code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, LANMAN_WKS_PARAM_KEY,
65 0, KEY_QUERY_VALUE, &parmKey);
66 if (code == ERROR_SUCCESS)
68 BOOL extTimeouts = msftSMBRedirectorSupportsExtendedTimeouts();
72 * The default value is 1000 seconds. However, this default
73 * will not apply to "\\AFS" unless "AFS" is listed in
74 * ServersWithExtendedSessTimeout which we will add when we
75 * create the ExtendedSessTimeout value in smb_Init()
77 dummyLen = sizeof(DWORD);
78 code = RegQueryValueEx(parmKey,
79 LANMAN_WKS_EXT_SESSION_TIMEOUT,
81 (BYTE *) &dwValue, &dummyLen);
82 if (code == ERROR_SUCCESS) {
84 afsi_log("lanmanworkstation : ExtSessTimeout %u", RDRtimeout);
87 if (!extTimeouts || code != ERROR_SUCCESS) {
88 dummyLen = sizeof(DWORD);
89 code = RegQueryValueEx(parmKey,
90 LANMAN_WKS_SESSION_TIMEOUT,
92 (BYTE *) &dwValue, &dummyLen);
93 if (code == ERROR_SUCCESS) {
95 afsi_log("lanmanworkstation : SessTimeout %u", RDRtimeout);
101 code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY,
102 0, KEY_QUERY_VALUE, &parmKey);
103 if (code == ERROR_SUCCESS) {
104 dummyLen = sizeof(DWORD);
105 code = RegQueryValueEx(parmKey, "ConnDeadTimeout", NULL, NULL,
106 (BYTE *) &dwValue, &dummyLen);
107 if (code == ERROR_SUCCESS) {
108 ConnDeadtimeout = (unsigned short)dwValue;
109 afsi_log("ConnDeadTimeout is %d", ConnDeadtimeout);
111 dummyLen = sizeof(DWORD);
112 code = RegQueryValueEx(parmKey, "HardDeadTimeout", NULL, NULL,
113 (BYTE *) &dwValue, &dummyLen);
114 if (code == ERROR_SUCCESS) {
115 HardDeadtimeout = (unsigned short)dwValue;
116 afsi_log("HardDeadTimeout is %d", HardDeadtimeout);
118 dummyLen = sizeof(DWORD);
119 code = RegQueryValueEx(parmKey, "IdleDeadTimeout", NULL, NULL,
120 (BYTE *) &dwValue, &dummyLen);
121 if (code == ERROR_SUCCESS) {
122 IdleDeadtimeout = (unsigned short)dwValue;
123 afsi_log("IdleDeadTimeout is %d", IdleDeadtimeout);
125 dummyLen = sizeof(DWORD);
126 code = RegQueryValueEx(parmKey, "NatPingInterval", NULL, NULL,
127 (BYTE *) &dwValue, &dummyLen);
128 if (code == ERROR_SUCCESS) {
129 NatPingInterval = (unsigned short)dwValue;
131 afsi_log("NatPingInterval is %d", NatPingInterval);
132 RegCloseKey(parmKey);
136 * If these values were not set via cpp macro or obtained
137 * from the registry, we use a value that is derived from
138 * the smb redirector session timeout (RDRtimeout).
140 * The UNIX cache manager uses 120 seconds for the hard dead
141 * timeout and 50 seconds for the connection and idle timeouts.
143 * We base our values on those while making sure we leave
144 * enough time for overhead.
146 if (ConnDeadtimeout == 0) {
147 ConnDeadtimeout = (unsigned short) ((RDRtimeout / 2) < 50 ? (RDRtimeout / 2) : 50);
148 afsi_log("ConnDeadTimeout is %d", ConnDeadtimeout);
150 if (HardDeadtimeout == 0) {
151 HardDeadtimeout = (unsigned short) (RDRtimeout > 125 ? 120 : (RDRtimeout - 5));
152 afsi_log("HardDeadTimeout is %d", HardDeadtimeout);
154 if (IdleDeadtimeout == 0) {
155 IdleDeadtimeout = (unsigned short) ConnDeadtimeout;
156 afsi_log("IdleDeadTimeout is %d", IdleDeadtimeout);
162 void cm_InitReq(cm_req_t *reqp)
164 memset(reqp, 0, sizeof(cm_req_t));
165 reqp->startTime = GetTickCount();
168 static long cm_GetServerList(struct cm_fid *fidp, struct cm_user *userp,
169 struct cm_req *reqp, cm_serverRef_t ***serversppp)
172 cm_volume_t *volp = NULL;
173 cm_cell_t *cellp = NULL;
177 return CM_ERROR_INVAL;
180 cellp = cm_FindCellByID(fidp->cell, 0);
182 return CM_ERROR_NOSUCHCELL;
184 code = cm_FindVolumeByID(cellp, fidp->volume, userp, reqp, CM_GETVOL_FLAG_CREATE, &volp);
188 *serversppp = cm_GetVolServers(volp, fidp->volume, userp, reqp);
190 lock_ObtainRead(&cm_volumeLock);
192 lock_ReleaseRead(&cm_volumeLock);
193 return (*serversppp ? 0 : CM_ERROR_NOSUCHVOLUME);
197 * Analyze the error return from an RPC. Determine whether or not to retry,
198 * and if we're going to retry, determine whether failover is appropriate,
199 * and whether timed backoff is appropriate.
201 * If the error code is from cm_ConnFromFID() or friends, it will be a CM_ERROR code.
202 * Otherwise it will be an RPC code. This may be a UNIX code (e.g. EDQUOT), or
203 * it may be an RX code, or it may be a special code (e.g. VNOVOL), or it may
204 * be a security code (e.g. RXKADEXPIRED).
206 * If the error code is from cm_ConnFromFID() or friends, connp will be NULL.
208 * For VLDB calls, fidp will be NULL.
210 * volSyncp and/or cbrp may also be NULL.
213 cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp,
215 AFSVolSync *volSyncp,
216 cm_serverRef_t * serversp,
217 cm_callbackRequest_t *cbrp, long errorCode)
219 cm_server_t *serverp = NULL;
220 cm_serverRef_t **serverspp = NULL;
221 cm_serverRef_t *tsrp;
222 cm_cell_t *cellp = NULL;
224 cm_volume_t * volp = NULL;
225 cm_vol_state_t *statep = NULL;
227 int free_svr_list = 0;
229 long timeUsed, timeLeft;
231 char addr[16]="unknown";
236 osi_Log2(afsd_logp, "cm_Analyze connp 0x%p, code 0x%x",
239 /* no locking required, since connp->serverp never changes after
241 dead_session = (userp->cellInfop == NULL);
243 serverp = connp->serverp;
245 /* Update callback pointer */
246 if (cbrp && serverp && errorCode == 0) {
248 if ( cbrp->serverp != serverp ) {
249 lock_ObtainWrite(&cm_serverLock);
250 cm_PutServerNoLock(cbrp->serverp);
251 cm_GetServerNoLock(serverp);
252 lock_ReleaseWrite(&cm_serverLock);
255 cm_GetServer(serverp);
257 lock_ObtainWrite(&cm_callbackLock);
258 cbrp->serverp = serverp;
259 lock_ReleaseWrite(&cm_callbackLock);
262 /* if timeout - check that it did not exceed the HardDead timeout
265 /* timeleft - get it from reqp the same way as cm_ConnByMServers does */
266 timeUsed = (GetTickCount() - reqp->startTime) / 1000;
267 timeLeft = HardDeadtimeout - timeUsed;
269 /* get a pointer to the cell */
271 if (cellp == NULL && serverp)
272 cellp = serverp->cellp;
273 if (cellp == NULL && serversp) {
274 struct cm_serverRef * refp;
275 for ( refp=serversp ; cellp == NULL && refp != NULL; refp=refp->next) {
276 if (refp->status == srv_deleted)
279 cellp = refp->server->cellp;
282 if (cellp == NULL && fidp) {
283 cellp = cm_FindCellByID(fidp->cell, 0);
287 if (errorCode == CM_ERROR_TIMEDOUT) {
288 if ( timeLeft > 5 ) {
290 cm_CheckServers(CM_FLAG_CHECKDOWNSERVERS, cellp);
295 else if (errorCode == UAEWOULDBLOCK || errorCode == EWOULDBLOCK ||
296 errorCode == UAEAGAIN || errorCode == EAGAIN) {
297 osi_Log0(afsd_logp, "cm_Analyze passed EWOULDBLOCK or EAGAIN.");
298 if ( timeLeft > 5 ) {
304 /* if there is nosuchvolume, then we have a situation in which a
305 * previously known volume no longer has a set of servers
306 * associated with it. Either the volume has moved or
307 * the volume has been deleted. Try to find a new server list
308 * until the timeout period expires.
310 else if (errorCode == CM_ERROR_NOSUCHVOLUME) {
311 osi_Log0(afsd_logp, "cm_Analyze passed CM_ERROR_NOSUCHVOLUME.");
313 * The VNOVOL or VL_NOENT error has already been translated
314 * to CM_ERROR_NOSUCHVOLUME. There is nothing for us to do.
318 else if (errorCode == CM_ERROR_ALLDOWN) {
319 /* Servers marked DOWN will be restored by the background daemon
320 * thread as they become available. The volume status is
321 * updated as the server state changes.
324 osi_Log2(afsd_logp, "cm_Analyze passed CM_ERROR_DOWN (FS cell %s vol 0x%x)",
325 cellp->name, fidp->volume);
326 msgID = MSG_ALL_SERVERS_DOWN;
327 format = "All servers are unreachable when accessing cell %s volume %d.";
328 LogEvent(EVENTLOG_WARNING_TYPE, msgID, cellp->name, fidp->volume);
330 osi_Log0(afsd_logp, "cm_Analyze passed CM_ERROR_ALLDOWN (VL Server)");
334 else if (errorCode == CM_ERROR_ALLOFFLINE) {
335 /* Volume instances marked offline will be restored by the
336 * background daemon thread as they become available
339 osi_Log2(afsd_logp, "cm_Analyze passed CM_ERROR_ALLOFFLINE (FS cell %s vol 0x%x)",
340 cellp->name, fidp->volume);
341 msgID = MSG_ALL_SERVERS_OFFLINE;
342 format = "All servers are offline when accessing cell %s volume %d.";
343 LogEvent(EVENTLOG_WARNING_TYPE, msgID, cellp->name, fidp->volume);
345 code = cm_FindVolumeByID(cellp, fidp->volume, userp, reqp,
346 CM_GETVOL_FLAG_NO_LRU_UPDATE,
352 /* cm_CheckOfflineVolume() resets the serverRef state */
353 if (cm_CheckOfflineVolume(volp, fidp->volume))
356 cm_UpdateVolumeStatus(volp, fidp->volume);
358 lock_ObtainRead(&cm_volumeLock);
360 lock_ReleaseRead(&cm_volumeLock);
364 osi_Log0(afsd_logp, "cm_Analyze passed CM_ERROR_ALLOFFLINE (VL Server)");
367 else if (errorCode == CM_ERROR_ALLBUSY) {
368 /* Volumes that are busy cannot be determined to be non-busy
369 * without actually attempting to access them.
371 if (fidp) { /* File Server query */
372 osi_Log2(afsd_logp, "cm_Analyze passed CM_ERROR_ALLBUSY (FS cell %s vol 0x%x)",
373 cellp->name, fidp->volume);
374 msgID = MSG_ALL_SERVERS_BUSY;
375 format = "All servers are busy when accessing cell %s volume %d.";
376 LogEvent(EVENTLOG_WARNING_TYPE, msgID, cellp->name, fidp->volume);
378 code = cm_FindVolumeByID(cellp, fidp->volume, userp, reqp,
379 CM_GETVOL_FLAG_NO_LRU_UPDATE,
385 statep = cm_VolumeStateByID(volp, fidp->volume);
386 if (statep->state != vl_offline &&
387 statep->state != vl_busy &&
388 statep->state != vl_unknown) {
392 code = cm_GetServerList(fidp, userp, reqp, &serverspp);
394 serversp = *serverspp;
398 lock_ObtainWrite(&cm_serverLock);
399 for (tsrp = serversp; tsrp; tsrp=tsrp->next) {
400 if (tsrp->status == srv_deleted)
402 if (tsrp->status == srv_busy) {
403 tsrp->status = srv_not_busy;
406 lock_ReleaseWrite(&cm_serverLock);
408 cm_FreeServerList(serverspp, 0);
414 cm_UpdateVolumeStatus(volp, fidp->volume);
418 cm_UpdateVolumeStatus(volp, fidp->volume);
421 lock_ObtainRead(&cm_volumeLock);
423 lock_ReleaseRead(&cm_volumeLock);
426 } else { /* VL Server query */
427 osi_Log0(afsd_logp, "cm_Analyze passed CM_ERROR_ALLBUSY (VL Server).");
433 lock_ObtainWrite(&cm_serverLock);
434 for (tsrp = serversp; tsrp; tsrp=tsrp->next) {
435 if (tsrp->status == srv_deleted)
437 if (tsrp->status == srv_busy) {
438 tsrp->status = srv_not_busy;
441 lock_ReleaseWrite(&cm_serverLock);
448 /* special codes: VBUSY and VRESTARTING */
449 else if (errorCode == VBUSY || errorCode == VRESTARTING) {
450 if (!serversp && fidp) {
451 code = cm_GetServerList(fidp, userp, reqp, &serverspp);
453 serversp = *serverspp;
458 switch ( errorCode ) {
460 msgID = MSG_SERVER_REPORTS_VBUSY;
461 format = "Server %s reported busy when accessing volume %d.";
464 msgID = MSG_SERVER_REPORTS_VRESTARTING;
465 format = "Server %s reported restarting when accessing volume %d.";
469 if (serverp && fidp) {
470 /* Log server being offline for this volume */
471 sprintf(addr, "%d.%d.%d.%d",
472 ((serverp->addr.sin_addr.s_addr & 0xff)),
473 ((serverp->addr.sin_addr.s_addr & 0xff00)>> 8),
474 ((serverp->addr.sin_addr.s_addr & 0xff0000)>> 16),
475 ((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24));
477 osi_Log2(afsd_logp, format, osi_LogSaveString(afsd_logp,addr), fidp->volume);
478 LogEvent(EVENTLOG_WARNING_TYPE, msgID, addr, fidp->volume);
481 lock_ObtainWrite(&cm_serverLock);
482 for (tsrp = serversp; tsrp; tsrp=tsrp->next) {
483 if (tsrp->status == srv_deleted)
485 if (tsrp->server == serverp && tsrp->status == srv_not_busy) {
486 tsrp->status = srv_busy;
487 if (fidp) { /* File Server query */
488 lock_ReleaseWrite(&cm_serverLock);
489 code = cm_FindVolumeByID(cellp, fidp->volume, userp, reqp,
490 CM_GETVOL_FLAG_NO_LRU_UPDATE,
493 statep = cm_VolumeStateByID(volp, fidp->volume);
494 lock_ObtainWrite(&cm_serverLock);
499 lock_ReleaseWrite(&cm_serverLock);
502 cm_UpdateVolumeStatus(volp, statep->ID);
503 lock_ObtainRead(&cm_volumeLock);
505 lock_ReleaseRead(&cm_volumeLock);
510 cm_FreeServerList(serverspp, 0);
518 /* special codes: missing volumes */
519 else if (errorCode == VNOVOL || errorCode == VMOVED || errorCode == VOFFLINE ||
520 errorCode == VSALVAGE || errorCode == VNOSERVICE || errorCode == VIO)
522 /* In case of timeout */
523 reqp->volumeError = errorCode;
525 switch ( errorCode ) {
527 msgID = MSG_SERVER_REPORTS_VNOVOL;
528 format = "Server %s reported volume %d as not attached (does not exist).";
531 msgID = MSG_SERVER_REPORTS_VMOVED;
532 format = "Server %s reported volume %d as moved.";
535 msgID = MSG_SERVER_REPORTS_VOFFLINE;
536 format = "Server %s reported volume %d as offline.";
539 msgID = MSG_SERVER_REPORTS_VSALVAGE;
540 format = "Server %s reported volume %d as needs salvage.";
543 msgID = MSG_SERVER_REPORTS_VNOSERVICE;
544 format = "Server %s reported volume %d as not in service.";
547 msgID = MSG_SERVER_REPORTS_VIO;
548 format = "Server %s reported volume %d as temporarily unaccessible.";
552 if (serverp && fidp) {
553 /* Log server being offline for this volume */
554 sprintf(addr, "%d.%d.%d.%d",
555 ((serverp->addr.sin_addr.s_addr & 0xff)),
556 ((serverp->addr.sin_addr.s_addr & 0xff00)>> 8),
557 ((serverp->addr.sin_addr.s_addr & 0xff0000)>> 16),
558 ((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24));
560 osi_Log2(afsd_logp, format, osi_LogSaveString(afsd_logp,addr), fidp->volume);
561 LogEvent(EVENTLOG_WARNING_TYPE, msgID, addr, fidp->volume);
565 * Mark server offline for this volume or delete the volume
566 * from the server list if it was moved or is not present.
568 if (!serversp && fidp) {
569 code = cm_GetServerList(fidp, userp, reqp, &serverspp);
571 serversp = *serverspp;
576 lock_ObtainWrite(&cm_serverLock);
577 for (tsrp = serversp; tsrp; tsrp=tsrp->next) {
578 if (tsrp->status == srv_deleted)
581 sprintf(addr, "%d.%d.%d.%d",
582 ((tsrp->server->addr.sin_addr.s_addr & 0xff)),
583 ((tsrp->server->addr.sin_addr.s_addr & 0xff00)>> 8),
584 ((tsrp->server->addr.sin_addr.s_addr & 0xff0000)>> 16),
585 ((tsrp->server->addr.sin_addr.s_addr & 0xff000000)>> 24));
587 if (tsrp->server == serverp) {
589 if (errorCode == VMOVED || errorCode == VNOVOL) {
590 osi_Log2(afsd_logp, "volume %d not present on server %s",
591 fidp->volume, osi_LogSaveString(afsd_logp,addr));
592 tsrp->status = srv_deleted;
594 cm_RemoveVolumeFromServer(serverp, fidp->volume);
596 osi_Log2(afsd_logp, "volume %d instance on server %s marked offline",
597 fidp->volume, osi_LogSaveString(afsd_logp,addr));
598 tsrp->status = srv_offline;
602 osi_Log3(afsd_logp, "volume %d exists on server %s with status %u",
603 fidp->volume, osi_LogSaveString(afsd_logp,addr), tsrp->status);
606 lock_ReleaseWrite(&cm_serverLock);
608 /* Free the server list before cm_ForceUpdateVolume is called */
610 cm_FreeServerList(serverspp, 0);
616 if (fidp) { /* File Server query */
617 code = cm_FindVolumeByID(cellp, fidp->volume, userp, reqp,
618 CM_GETVOL_FLAG_NO_LRU_UPDATE,
621 statep = cm_VolumeStateByID(volp, fidp->volume);
623 if ((errorCode == VMOVED || errorCode == VNOVOL) &&
624 !(reqp->flags & CM_REQ_VOLUME_UPDATED))
626 code = cm_ForceUpdateVolume(fidp, userp, reqp);
628 timeLeft = 0; /* prevent a retry on failure */
630 reqp->flags |= CM_REQ_VOLUME_UPDATED;
631 osi_Log3(afsd_logp, "cm_Analyze called cm_ForceUpdateVolume cell %u vol %u code 0x%x",
632 fidp->cell, fidp->volume, code);
636 cm_UpdateVolumeStatus(volp, statep->ID);
637 osi_Log3(afsd_logp, "cm_Analyze NewVolState cell %u vol %u state %u",
638 fidp->cell, fidp->volume, statep->state);
642 lock_ObtainRead(&cm_volumeLock);
644 lock_ReleaseRead(&cm_volumeLock);
651 } else if ( errorCode == VNOVNODE ) {
654 osi_Log4(afsd_logp, "cm_Analyze passed VNOVNODE cell %u vol %u vn %u uniq %u.",
655 fidp->cell, fidp->volume, fidp->vnode, fidp->unique);
657 scp = cm_FindSCache(fidp);
659 cm_scache_t *pscp = NULL;
661 if (scp->fileType != CM_SCACHETYPE_DIRECTORY)
662 pscp = cm_FindSCacheParent(scp);
664 lock_ObtainWrite(&scp->rw);
665 lock_ObtainWrite(&cm_scacheLock);
666 cm_RemoveSCacheFromHashTable(scp);
667 lock_ReleaseWrite(&cm_scacheLock);
668 cm_LockMarkSCacheLost(scp);
669 scp->flags |= CM_SCACHEFLAG_DELETED;
670 lock_ReleaseWrite(&scp->rw);
671 cm_ReleaseSCache(scp);
674 if (cm_HaveCallback(pscp)) {
675 lock_ObtainWrite(&pscp->rw);
676 cm_DiscardSCache(pscp);
677 lock_ReleaseWrite(&pscp->rw);
679 cm_ReleaseSCache(pscp);
683 osi_Log0(afsd_logp, "cm_Analyze passed VNOVNODE unknown fid.");
688 else if (errorCode == RX_CALL_TIMEOUT) {
689 /* RPC took longer than hardDeadTime or the server
690 * reported idle for longer than idleDeadTime
691 * don't mark server as down but don't retry
692 * this is to prevent the SMB session from timing out
693 * In addition, we log an event to the event log
697 sprintf(addr, "%d.%d.%d.%d",
698 ((serverp->addr.sin_addr.s_addr & 0xff)),
699 ((serverp->addr.sin_addr.s_addr & 0xff00)>> 8),
700 ((serverp->addr.sin_addr.s_addr & 0xff0000)>> 16),
701 ((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24));
703 LogEvent(EVENTLOG_WARNING_TYPE, MSG_RX_HARD_DEAD_TIME_EXCEEDED, addr);
704 osi_Log1(afsd_logp, "cm_Analyze: hardDeadTime or idleDeadtime exceeded addr[%s]",
705 osi_LogSaveString(afsd_logp,addr));
706 reqp->tokenIdleErrorServp = serverp;
710 if (!fidp) { /* vldb */
713 cm_volume_t *volp = cm_GetVolumeByFID(fidp);
715 if (fidp->volume == cm_GetROVolumeID(volp))
723 else if (errorCode >= -64 && errorCode < 0) {
724 /* mark server as down */
726 sprintf(addr, "%d.%d.%d.%d",
727 ((serverp->addr.sin_addr.s_addr & 0xff)),
728 ((serverp->addr.sin_addr.s_addr & 0xff00)>> 8),
729 ((serverp->addr.sin_addr.s_addr & 0xff0000)>> 16),
730 ((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24));
732 if (errorCode == RX_CALL_DEAD)
733 osi_Log2(afsd_logp, "cm_Analyze: Rx Call Dead addr[%s] forcedNew[%s]",
734 osi_LogSaveString(afsd_logp,addr),
735 (reqp->flags & CM_REQ_NEW_CONN_FORCED ? "yes" : "no"));
737 osi_Log3(afsd_logp, "cm_Analyze: Rx Misc Error[%d] addr[%s] forcedNew[%s]",
739 osi_LogSaveString(afsd_logp,addr),
740 (reqp->flags & CM_REQ_NEW_CONN_FORCED ? "yes" : "no"));
743 lock_ObtainMutex(&serverp->mx);
744 if (errorCode == RX_CALL_DEAD &&
745 (reqp->flags & CM_REQ_NEW_CONN_FORCED)) {
746 if (!(serverp->flags & CM_SERVERFLAG_DOWN)) {
747 serverp->flags |= CM_SERVERFLAG_DOWN;
748 serverp->downTime = time(NULL);
751 if (reqp->flags & CM_REQ_NEW_CONN_FORCED) {
752 reqp->tokenIdleErrorServp = serverp;
753 reqp->tokenError = errorCode;
755 reqp->flags |= CM_REQ_NEW_CONN_FORCED;
759 lock_ReleaseMutex(&serverp->mx);
760 cm_ForceNewConnections(serverp);
765 else if (errorCode == RXKADEXPIRED) {
766 osi_Log1(afsd_logp, "cm_Analyze: rxkad error code 0x%x (RXKADEXPIRED)",
769 lock_ObtainMutex(&userp->mx);
770 ucellp = cm_GetUCell(userp, serverp->cellp);
771 if (ucellp->ticketp) {
772 free(ucellp->ticketp);
773 ucellp->ticketp = NULL;
775 ucellp->flags &= ~CM_UCELLFLAG_RXKAD;
777 lock_ReleaseMutex(&userp->mx);
781 } else if (errorCode >= ERROR_TABLE_BASE_RXK && errorCode < ERROR_TABLE_BASE_RXK + 256) {
782 char * s = "unknown error";
783 switch ( errorCode ) {
784 case RXKADINCONSISTENCY: s = "RXKADINCONSISTENCY"; break;
785 case RXKADPACKETSHORT : s = "RXKADPACKETSHORT"; break;
786 case RXKADLEVELFAIL : s = "RXKADLEVELFAIL"; break;
787 case RXKADTICKETLEN : s = "RXKADTICKETLEN"; break;
788 case RXKADOUTOFSEQUENCE: s = "RXKADOUTOFSEQUENCE"; break;
789 case RXKADNOAUTH : s = "RXKADNOAUTH"; break;
790 case RXKADBADKEY : s = "RXKADBADKEY"; break;
791 case RXKADBADTICKET : s = "RXKADBADTICKET"; break;
792 case RXKADUNKNOWNKEY : s = "RXKADUNKNOWNKEY"; break;
793 case RXKADEXPIRED : s = "RXKADEXPIRED"; break;
794 case RXKADSEALEDINCON : s = "RXKADSEALEDINCON"; break;
795 case RXKADDATALEN : s = "RXKADDATALEN"; break;
796 case RXKADILLEGALLEVEL : s = "RXKADILLEGALLEVEL"; break;
798 osi_Log2(afsd_logp, "cm_Analyze: rxkad error code 0x%x (%s)",
802 reqp->tokenIdleErrorServp = serverp;
803 reqp->tokenError = errorCode;
806 } else if (errorCode >= ERROR_TABLE_BASE_U && errorCode < ERROR_TABLE_BASE_U + 256) {
808 * We received a ubik error. its possible that the server we are
809 * communicating with has a corrupted database or is partitioned
810 * from the rest of the servers and another server might be able
811 * to answer our query. Therefore, we will retry the request
812 * and force the use of another server.
815 reqp->tokenIdleErrorServp = serverp;
816 reqp->tokenError = errorCode;
819 } else if (errorCode == VICECONNBAD || errorCode == VICETOKENDEAD) {
820 cm_ForceNewConnections(serverp);
825 char * s = "unknown error";
826 switch ( errorCode ) {
827 case VSALVAGE : s = "VSALVAGE"; break;
828 case VNOVNODE : s = "VNOVNODE"; break;
829 case VNOVOL : s = "VNOVOL"; break;
830 case VVOLEXISTS : s = "VVOLEXISTS"; break;
831 case VNOSERVICE : s = "VNOSERVICE"; break;
832 case VOFFLINE : s = "VOFFLINE"; break;
833 case VONLINE : s = "VONLINE"; break;
834 case VDISKFULL : s = "VDISKFULL"; break;
835 case VOVERQUOTA : s = "VOVERQUOTA"; break;
836 case VBUSY : s = "VBUSY"; break;
837 case VMOVED : s = "VMOVED"; break;
838 case VIO : s = "VIO"; break;
839 case VRESTRICTED : s = "VRESTRICTED"; break;
840 case VRESTARTING : s = "VRESTARTING"; break;
841 case VREADONLY : s = "VREADONLY"; break;
842 case EAGAIN : s = "EAGAIN"; break;
843 case UAEAGAIN : s = "UAEAGAIN"; break;
844 case EINVAL : s = "EINVAL"; break;
845 case UAEINVAL : s = "UAEINVAL"; break;
846 case EACCES : s = "EACCES"; break;
847 case UAEACCES : s = "UAEACCES"; break;
848 case ENOENT : s = "ENOENT"; break;
849 case UAENOENT : s = "UAENOENT"; break;
850 case EEXIST : s = "EEXIST"; break;
851 case UAEEXIST : s = "UAEEXIST"; break;
852 case VICECONNBAD : s = "VICECONNBAD"; break;
853 case VICETOKENDEAD : s = "VICETOKENDEAD"; break;
854 case WSAEWOULDBLOCK : s = "WSAEWOULDBLOCK"; break;
855 case UAEWOULDBLOCK : s = "UAEWOULDBLOCK"; break;
856 case VL_IDEXIST : s = "VL_IDEXIST"; break;
857 case VL_IO : s = "VL_IO"; break;
858 case VL_NAMEEXIST : s = "VL_NAMEEXIST"; break;
859 case VL_CREATEFAIL : s = "VL_CREATEFAIL"; break;
860 case VL_NOENT : s = "VL_NOENT"; break;
861 case VL_EMPTY : s = "VL_EMPTY"; break;
862 case VL_ENTDELETED : s = "VL_ENTDELETED"; break;
863 case VL_BADNAME : s = "VL_BADNAME"; break;
864 case VL_BADINDEX : s = "VL_BADINDEX"; break;
865 case VL_BADVOLTYPE : s = "VL_BADVOLTYPE"; break;
866 case VL_BADSERVER : s = "VL_BADSERVER"; break;
867 case VL_BADPARTITION : s = "VL_BADPARTITION"; break;
868 case VL_REPSFULL : s = "VL_REPSFULL"; break;
869 case VL_NOREPSERVER : s = "VL_NOREPSERVER"; break;
870 case VL_DUPREPSERVER : s = "VL_DUPREPSERVER"; break;
871 case VL_RWNOTFOUND : s = "VL_RWNOTFOUND"; break;
872 case VL_BADREFCOUNT : s = "VL_BADREFCOUNT"; break;
873 case VL_SIZEEXCEEDED : s = "VL_SIZEEXCEEDED"; break;
874 case VL_BADENTRY : s = "VL_BADENTRY"; break;
875 case VL_BADVOLIDBUMP : s = "VL_BADVOLIDBUMP"; break;
876 case VL_IDALREADYHASHED: s = "VL_IDALREADYHASHED"; break;
877 case VL_ENTRYLOCKED : s = "VL_ENTRYLOCKED"; break;
878 case VL_BADVOLOPER : s = "VL_BADVOLOPER"; break;
879 case VL_BADRELLOCKTYPE : s = "VL_BADRELLOCKTYPE"; break;
880 case VL_RERELEASE : s = "VL_RERELEASE"; break;
881 case VL_BADSERVERFLAG : s = "VL_BADSERVERFLAG"; break;
882 case VL_PERM : s = "VL_PERM"; break;
883 case VL_NOMEM : s = "VL_NOMEM"; break;
884 case VL_BADVERSION : s = "VL_BADVERSION"; break;
885 case VL_INDEXERANGE : s = "VL_INDEXERANGE"; break;
886 case VL_MULTIPADDR : s = "VL_MULTIPADDR"; break;
887 case VL_BADMASK : s = "VL_BADMASK"; break;
888 case CM_ERROR_NOSUCHCELL : s = "CM_ERROR_NOSUCHCELL"; break;
889 case CM_ERROR_NOSUCHVOLUME : s = "CM_ERROR_NOSUCHVOLUME"; break;
890 case CM_ERROR_TIMEDOUT : s = "CM_ERROR_TIMEDOUT"; break;
891 case CM_ERROR_RETRY : s = "CM_ERROR_RETRY"; break;
892 case CM_ERROR_NOACCESS : s = "CM_ERROR_NOACCESS"; break;
893 case CM_ERROR_NOSUCHFILE : s = "CM_ERROR_NOSUCHFILE"; break;
894 case CM_ERROR_STOPNOW : s = "CM_ERROR_STOPNOW"; break;
895 case CM_ERROR_TOOBIG : s = "CM_ERROR_TOOBIG"; break;
896 case CM_ERROR_INVAL : s = "CM_ERROR_INVAL"; break;
897 case CM_ERROR_BADFD : s = "CM_ERROR_BADFD"; break;
898 case CM_ERROR_BADFDOP : s = "CM_ERROR_BADFDOP"; break;
899 case CM_ERROR_EXISTS : s = "CM_ERROR_EXISTS"; break;
900 case CM_ERROR_CROSSDEVLINK : s = "CM_ERROR_CROSSDEVLINK"; break;
901 case CM_ERROR_BADOP : s = "CM_ERROR_BADOP"; break;
902 case CM_ERROR_BADPASSWORD : s = "CM_ERROR_BADPASSWORD"; break;
903 case CM_ERROR_NOTDIR : s = "CM_ERROR_NOTDIR"; break;
904 case CM_ERROR_ISDIR : s = "CM_ERROR_ISDIR"; break;
905 case CM_ERROR_READONLY : s = "CM_ERROR_READONLY"; break;
906 case CM_ERROR_WOULDBLOCK : s = "CM_ERROR_WOULDBLOCK"; break;
907 case CM_ERROR_QUOTA : s = "CM_ERROR_QUOTA"; break;
908 case CM_ERROR_SPACE : s = "CM_ERROR_SPACE"; break;
909 case CM_ERROR_BADSHARENAME : s = "CM_ERROR_BADSHARENAME"; break;
910 case CM_ERROR_BADTID : s = "CM_ERROR_BADTID"; break;
911 case CM_ERROR_UNKNOWN : s = "CM_ERROR_UNKNOWN"; break;
912 case CM_ERROR_NOMORETOKENS : s = "CM_ERROR_NOMORETOKENS"; break;
913 case CM_ERROR_NOTEMPTY : s = "CM_ERROR_NOTEMPTY"; break;
914 case CM_ERROR_USESTD : s = "CM_ERROR_USESTD"; break;
915 case CM_ERROR_REMOTECONN : s = "CM_ERROR_REMOTECONN"; break;
916 case CM_ERROR_ATSYS : s = "CM_ERROR_ATSYS"; break;
917 case CM_ERROR_NOSUCHPATH : s = "CM_ERROR_NOSUCHPATH"; break;
918 case CM_ERROR_CLOCKSKEW : s = "CM_ERROR_CLOCKSKEW"; break;
919 case CM_ERROR_BADSMB : s = "CM_ERROR_BADSMB"; break;
920 case CM_ERROR_ALLBUSY : s = "CM_ERROR_ALLBUSY"; break;
921 case CM_ERROR_NOFILES : s = "CM_ERROR_NOFILES"; break;
922 case CM_ERROR_PARTIALWRITE : s = "CM_ERROR_PARTIALWRITE"; break;
923 case CM_ERROR_NOIPC : s = "CM_ERROR_NOIPC"; break;
924 case CM_ERROR_BADNTFILENAME : s = "CM_ERROR_BADNTFILENAME"; break;
925 case CM_ERROR_BUFFERTOOSMALL : s = "CM_ERROR_BUFFERTOOSMALL"; break;
926 case CM_ERROR_RENAME_IDENTICAL : s = "CM_ERROR_RENAME_IDENTICAL"; break;
927 case CM_ERROR_ALLOFFLINE : s = "CM_ERROR_ALLOFFLINE"; break;
928 case CM_ERROR_AMBIGUOUS_FILENAME: s = "CM_ERROR_AMBIGUOUS_FILENAME"; break;
929 case CM_ERROR_BADLOGONTYPE : s = "CM_ERROR_BADLOGONTYPE"; break;
930 case CM_ERROR_GSSCONTINUE : s = "CM_ERROR_GSSCONTINUE"; break;
931 case CM_ERROR_TIDIPC : s = "CM_ERROR_TIDIPC"; break;
932 case CM_ERROR_TOO_MANY_SYMLINKS : s = "CM_ERROR_TOO_MANY_SYMLINKS"; break;
933 case CM_ERROR_PATH_NOT_COVERED : s = "CM_ERROR_PATH_NOT_COVERED"; break;
934 case CM_ERROR_LOCK_CONFLICT : s = "CM_ERROR_LOCK_CONFLICT"; break;
935 case CM_ERROR_SHARING_VIOLATION : s = "CM_ERROR_SHARING_VIOLATION"; break;
936 case CM_ERROR_ALLDOWN : s = "CM_ERROR_ALLDOWN"; break;
937 case CM_ERROR_TOOFEWBUFS : s = "CM_ERROR_TOOFEWBUFS"; break;
938 case CM_ERROR_TOOMANYBUFS : s = "CM_ERROR_TOOMANYBUFS"; break;
940 osi_Log2(afsd_logp, "cm_Analyze: ignoring error code 0x%x (%s)",
946 /* If not allowed to retry, don't */
947 if (!forcing_new && (reqp->flags & CM_REQ_NORETRY))
949 else if (retry && dead_session)
953 /* drop this on the way out */
958 * clear the volume updated flag if we succeed.
959 * this way the flag will not prevent a subsequent volume
960 * from being updated if necessary.
964 reqp->flags &= ~CM_REQ_VOLUME_UPDATED;
967 /* retry until we fail to find a connection */
971 long cm_ConnByMServers(cm_serverRef_t *serversp, cm_user_t *usersp,
972 cm_req_t *reqp, cm_conn_t **connpp)
975 cm_serverRef_t *tsrp;
978 int someBusy = 0, someOffline = 0, allOffline = 1, allBusy = 1, allDown = 1;
979 #ifdef SET_RX_TIMEOUTS_TO_TIMELEFT
980 long timeUsed, timeLeft, hardTimeLeft;
984 if (serversp == NULL) {
985 osi_Log1(afsd_logp, "cm_ConnByMServers returning 0x%x", CM_ERROR_ALLDOWN);
986 return CM_ERROR_ALLDOWN;
989 #ifdef SET_RX_TIMEOUTS_TO_TIMELEFT
990 timeUsed = (GetTickCount() - reqp->startTime) / 1000;
992 /* leave 5 seconds margin of safety */
993 timeLeft = ConnDeadtimeout - timeUsed - 5;
994 hardTimeLeft = HardDeadtimeout - timeUsed - 5;
997 lock_ObtainRead(&cm_serverLock);
998 for (tsrp = serversp; tsrp; tsrp=tsrp->next) {
999 if (tsrp->status == srv_deleted)
1003 if (reqp->tokenIdleErrorServp) {
1005 * search the list until we find the server
1006 * that failed last time. When we find it
1007 * clear the error, skip it and try the one
1010 if (tsp == reqp->tokenIdleErrorServp)
1011 reqp->tokenIdleErrorServp = NULL;
1015 cm_GetServerNoLock(tsp);
1016 lock_ReleaseRead(&cm_serverLock);
1017 if (!(tsp->flags & CM_SERVERFLAG_DOWN)) {
1019 if (tsrp->status == srv_busy) {
1022 } else if (tsrp->status == srv_offline) {
1028 code = cm_ConnByServer(tsp, usersp, connpp);
1029 if (code == 0) { /* cm_CBS only returns 0 */
1031 #ifdef SET_RX_TIMEOUTS_TO_TIMELEFT
1032 /* Set RPC timeout */
1033 if (timeLeft > ConnDeadtimeout)
1034 timeLeft = ConnDeadtimeout;
1036 if (hardTimeLeft > HardDeadtimeout)
1037 hardTimeLeft = HardDeadtimeout;
1039 lock_ObtainMutex(&(*connpp)->mx);
1040 rx_SetConnDeadTime((*connpp)->rxconnp, timeLeft);
1041 rx_SetConnHardDeadTime((*connpp)->rxconnp, (u_short) hardTimeLeft);
1042 lock_ReleaseMutex(&(*connpp)->mx);
1047 /* therefore, this code is never executed */
1048 if (firstError == 0)
1052 lock_ObtainRead(&cm_serverLock);
1053 cm_PutServerNoLock(tsp);
1056 lock_ReleaseRead(&cm_serverLock);
1058 if (firstError == 0) {
1060 firstError = (reqp->tokenError ? reqp->tokenError :
1061 (reqp->idleError ? RX_CALL_TIMEOUT : CM_ERROR_ALLDOWN));
1063 firstError = CM_ERROR_ALLBUSY;
1064 else if (allOffline || (someBusy && someOffline))
1065 firstError = CM_ERROR_ALLOFFLINE;
1067 osi_Log0(afsd_logp, "cm_ConnByMServers returning impossible error TIMEDOUT");
1068 firstError = CM_ERROR_TIMEDOUT;
1072 osi_Log1(afsd_logp, "cm_ConnByMServers returning 0x%x", firstError);
1076 /* called with a held server to GC all bad connections hanging off of the server */
1077 void cm_GCConnections(cm_server_t *serverp)
1083 lock_ObtainWrite(&cm_connLock);
1084 lcpp = &serverp->connsp;
1085 for (tcp = *lcpp; tcp; tcp = *lcpp) {
1087 if (userp && tcp->refCount == 0 && (userp->vcRefs == 0)) {
1088 /* do the deletion of this guy */
1089 cm_PutServer(tcp->serverp);
1090 cm_ReleaseUser(userp);
1092 rx_DestroyConnection(tcp->rxconnp);
1093 lock_FinalizeMutex(&tcp->mx);
1097 /* just advance to the next */
1101 lock_ReleaseWrite(&cm_connLock);
1104 static void cm_NewRXConnection(cm_conn_t *tcp, cm_ucell_t *ucellp,
1105 cm_server_t *serverp)
1107 unsigned short port;
1110 struct rx_securityClass *secObjp;
1112 port = serverp->addr.sin_port;
1113 switch (serverp->type) {
1114 case CM_SERVER_VLDB:
1119 case CM_SERVER_FILE:
1125 osi_panic("unknown server type", __FILE__, __LINE__);
1128 if (ucellp->flags & CM_UCELLFLAG_RXKAD) {
1132 tcp->cryptlevel = rxkad_clear;
1135 tcp->cryptlevel = rxkad_auth;
1138 tcp->cryptlevel = rxkad_crypt;
1140 secObjp = rxkad_NewClientSecurityObject(tcp->cryptlevel,
1141 &ucellp->sessionKey, ucellp->kvno,
1142 ucellp->ticketLen, ucellp->ticketp);
1146 tcp->cryptlevel = rxkad_clear;
1147 secObjp = rxnull_NewClientSecurityObject();
1149 osi_assertx(secObjp != NULL, "null rx_securityClass");
1150 tcp->rxconnp = rx_NewConnection(serverp->addr.sin_addr.s_addr,
1155 rx_SetConnDeadTime(tcp->rxconnp, ConnDeadtimeout);
1156 rx_SetConnHardDeadTime(tcp->rxconnp, HardDeadtimeout);
1157 rx_SetConnIdleDeadTime(tcp->rxconnp, IdleDeadtimeout);
1158 if (NatPingInterval)
1159 rx_SetConnSecondsUntilNatPing(tcp->rxconnp, NatPingInterval);
1160 tcp->ucgen = ucellp->gen;
1162 rxs_Release(secObjp); /* Decrement the initial refCount */
1165 long cm_ConnByServer(cm_server_t *serverp, cm_user_t *userp, cm_conn_t **connpp)
1172 if (cm_anonvldb && serverp->type == CM_SERVER_VLDB)
1173 userp = cm_rootUserp;
1175 lock_ObtainMutex(&userp->mx);
1176 lock_ObtainRead(&cm_connLock);
1177 for (tcp = serverp->connsp; tcp; tcp=tcp->nextp) {
1178 if (tcp->userp == userp)
1182 /* find ucell structure */
1183 ucellp = cm_GetUCell(userp, serverp->cellp);
1185 lock_ConvertRToW(&cm_connLock);
1186 for (tcp = serverp->connsp; tcp; tcp=tcp->nextp) {
1187 if (tcp->userp == userp)
1191 lock_ReleaseWrite(&cm_connLock);
1194 cm_GetServer(serverp);
1195 tcp = malloc(sizeof(*tcp));
1196 memset(tcp, 0, sizeof(*tcp));
1197 tcp->nextp = serverp->connsp;
1198 serverp->connsp = tcp;
1201 lock_InitializeMutex(&tcp->mx, "cm_conn_t mutex", LOCK_HIERARCHY_CONN);
1202 lock_ObtainMutex(&tcp->mx);
1203 tcp->serverp = serverp;
1204 tcp->cryptlevel = rxkad_clear;
1205 cm_NewRXConnection(tcp, ucellp, serverp);
1207 lock_ReleaseMutex(&tcp->mx);
1208 lock_ReleaseWrite(&cm_connLock);
1210 lock_ReleaseRead(&cm_connLock);
1212 InterlockedIncrement(&tcp->refCount);
1214 lock_ObtainMutex(&tcp->mx);
1215 if ((tcp->flags & CM_CONN_FLAG_FORCE_NEW) ||
1216 (tcp->ucgen < ucellp->gen) ||
1217 (tcp->cryptlevel != (ucellp->flags & CM_UCELLFLAG_RXKAD ? (cryptall == 1 ? rxkad_crypt : (cryptall == 2 ? rxkad_auth : rxkad_clear)) : rxkad_clear)))
1219 if (tcp->ucgen < ucellp->gen)
1220 osi_Log0(afsd_logp, "cm_ConnByServer replace connection due to token update");
1222 osi_Log0(afsd_logp, "cm_ConnByServer replace connection due to crypt change");
1223 tcp->flags &= ~CM_CONN_FLAG_FORCE_NEW;
1224 rx_DestroyConnection(tcp->rxconnp);
1225 cm_NewRXConnection(tcp, ucellp, serverp);
1227 lock_ReleaseMutex(&tcp->mx);
1229 lock_ReleaseMutex(&userp->mx);
1231 /* return this pointer to our caller */
1232 osi_Log1(afsd_logp, "cm_ConnByServer returning conn 0x%p", tcp);
1238 long cm_ServerAvailable(struct cm_fid *fidp, struct cm_user *userp)
1242 cm_serverRef_t **serverspp;
1243 cm_serverRef_t *tsrp;
1245 int someBusy = 0, someOffline = 0, allOffline = 1, allBusy = 1, allDown = 1;
1249 code = cm_GetServerList(fidp, userp, &req, &serverspp);
1253 lock_ObtainRead(&cm_serverLock);
1254 for (tsrp = *serverspp; tsrp; tsrp=tsrp->next) {
1255 if (tsrp->status == srv_deleted)
1258 if (!(tsp->flags & CM_SERVERFLAG_DOWN)) {
1260 if (tsrp->status == srv_busy) {
1263 } else if (tsrp->status == srv_offline) {
1272 lock_ReleaseRead(&cm_serverLock);
1273 cm_FreeServerList(serverspp, 0);
1279 else if (allOffline || (someBusy && someOffline))
1286 * The returned cm_conn_t ** object is released in the subsequent call
1289 long cm_ConnFromFID(struct cm_fid *fidp, struct cm_user *userp, cm_req_t *reqp,
1293 cm_serverRef_t **serverspp;
1297 code = cm_GetServerList(fidp, userp, reqp, &serverspp);
1302 code = cm_ConnByMServers(*serverspp, userp, reqp, connpp);
1303 cm_FreeServerList(serverspp, 0);
1308 long cm_ConnFromVolume(struct cm_volume *volp, unsigned long volid, struct cm_user *userp, cm_req_t *reqp,
1312 cm_serverRef_t **serverspp;
1316 serverspp = cm_GetVolServers(volp, volid, userp, reqp);
1318 code = cm_ConnByMServers(*serverspp, userp, reqp, connpp);
1319 cm_FreeServerList(serverspp, 0);
1324 extern struct rx_connection *
1325 cm_GetRxConn(cm_conn_t *connp)
1327 struct rx_connection * rxconnp;
1328 lock_ObtainMutex(&connp->mx);
1329 rxconnp = connp->rxconnp;
1330 rx_GetConnection(rxconnp);
1331 lock_ReleaseMutex(&connp->mx);
1335 void cm_ForceNewConnections(cm_server_t *serverp)
1339 lock_ObtainWrite(&cm_connLock);
1340 for (tcp = serverp->connsp; tcp; tcp=tcp->nextp) {
1341 lock_ObtainMutex(&tcp->mx);
1342 tcp->flags |= CM_CONN_FLAG_FORCE_NEW;
1343 lock_ReleaseMutex(&tcp->mx);
1345 lock_ReleaseWrite(&cm_connLock);