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>
11 #include <afs/afs_args.h>
18 #include <sys/socket.h>
28 /* read/write lock for all global storage in this module */
29 osi_rwlock_t cm_callbackLock;
32 #ifdef AFS_FREELANCE_CLIENT
33 extern int cm_fakeDirCallback;
34 extern int cm_fakeGettingCallback;
37 #ifdef AFS_FREELANCE_CLIENT
38 extern osi_mutex_t cm_Freelance_Lock;
41 /* count of # of callback breaking messages received by this CM so far. We use
42 * this count in determining whether there have been any callback breaks that
43 * apply to a call that returned a new callback. If the counter doesn't
44 * increase during a call, then we know that no callbacks were broken during
45 * that call, and thus that the callback that was just returned is still valid.
47 long cm_callbackCount;
49 /* count of number of RPCs potentially returning a callback executing now.
50 * When this counter hits zero, we can clear out the racing revokes list, since
51 * at that time, we know that none of the just-executed callback revokes will
52 * apply to any future call that returns a callback (since the latter hasn't
53 * even started execution yet).
55 long cm_activeCallbackGrantingCalls;
57 /* list of callbacks that have been broken recently. If a call returning a
58 * callback is executing and a callback revoke runs immediately after it at the
59 * server, the revoke may end up being processed before the response to the
60 * original callback granting call. We detect this by keeping a list of
61 * callback revokes that have been received since we *started* the callback
62 * granting call, and discarding any callbacks received for the same file ID,
63 * even if the callback revoke was received before the callback grant.
65 cm_racingRevokes_t *cm_racingRevokesp;
67 /* record a (potentially) racing revoke for this file ID; null means for all
68 * file IDs, and is used by InitCallBackState.
70 * The cancelFlags describe whether we're just discarding callbacks for the same
71 * file ID, the same volume, or all from the same server.
73 * Called with no locks held.
75 void cm_RecordRacingRevoke(cm_fid_t *fidp, long cancelFlags)
77 cm_racingRevokes_t *rp;
79 lock_ObtainWrite(&cm_callbackLock);
80 if (cm_activeCallbackGrantingCalls > 0) {
81 rp = malloc(sizeof(*rp));
82 memset(rp, 0, sizeof(*rp));
83 osi_QAdd((osi_queue_t **) &cm_racingRevokesp, &rp->q);
84 rp->flags |= (cancelFlags & CM_RACINGFLAG_ALL);
85 if (fidp) rp->fid = *fidp;
86 rp->callbackCount = ++cm_callbackCount;
88 lock_ReleaseWrite(&cm_callbackLock);
92 * When we lose a callback, may have to send change notification replies.
94 void cm_CallbackNotifyChange(cm_scache_t *scp)
96 if (scp->fileType == CM_SCACHETYPE_DIRECTORY) {
97 if (scp->flags & CM_SCACHEFLAG_ANYWATCH)
99 FILE_NOTIFY_GENERIC_DIRECTORY_FILTER,
100 scp, NULL, NULL, TRUE);
105 tfid.cell = scp->fid.cell;
106 tfid.volume = scp->fid.volume;
107 tfid.vnode = scp->parentVnode;
108 tfid.unique = scp->parentUnique;
109 dscp = cm_FindSCache(&tfid);
111 dscp->flags & CM_SCACHEFLAG_ANYWATCH)
113 FILE_NOTIFY_GENERIC_FILE_FILTER,
114 dscp, NULL, NULL, TRUE);
118 /* called with no locks held for every file ID that is revoked directly by
119 * a callback revoke call. Does not have to handle volume callback breaks,
120 * since those have already been split out.
122 * The callp parameter is currently unused.
124 void cm_RevokeCallback(struct rx_call *callp, AFSFid *fidp)
130 /* don't bother setting cell, since we won't be checking it (to aid
131 * in working with multi-homed servers: we don't know the cell if we
132 * don't recognize the IP address).
135 tfid.volume = fidp->Volume;
136 tfid.vnode = fidp->Vnode;
137 tfid.unique = fidp->Unique;
138 hash = CM_SCACHE_HASH(&tfid);
140 osi_Log3(afsd_logp, "Revoke callback vol %d vn %d un %d",
141 fidp->Volume, fidp->Vnode, fidp->Unique);
143 /* do this first, so that if we're executing a callback granting call
144 * at this moment, we kill it before it can be merged in. Otherwise,
145 * it could complete while we're doing the scan below, and get missed
146 * by both the scan and by this code.
148 cm_RecordRacingRevoke(&tfid, 0);
150 lock_ObtainWrite(&cm_scacheLock);
151 /* do all in the hash bucket, since we don't know how many we'll find with
154 for(scp = cm_hashTablep[hash]; scp; scp=scp->nextp) {
155 if (scp->fid.volume == tfid.volume &&
156 scp->fid.vnode == tfid.vnode &&
157 scp->fid.unique == tfid.unique) {
159 lock_ReleaseWrite(&cm_scacheLock);
160 osi_Log1(afsd_logp, "Revoke scp %x", scp);
161 lock_ObtainMutex(&scp->mx);
162 cm_DiscardSCache(scp);
163 lock_ReleaseMutex(&scp->mx);
164 cm_CallbackNotifyChange(scp);
165 lock_ObtainWrite(&cm_scacheLock);
169 lock_ReleaseWrite(&cm_scacheLock);
172 /* called to revoke a volume callback, which is typically issued when a volume
173 * is moved from one server to another.
175 * Called with no locks held.
177 void cm_RevokeVolumeCallback(struct rx_call *callp, AFSFid *fidp)
183 /* do this first, so that if we're executing a callback granting call
184 * at this moment, we kill it before it can be merged in. Otherwise,
185 * it could complete while we're doing the scan below, and get missed
186 * by both the scan and by this code.
188 tfid.cell = tfid.vnode = tfid.unique = 0;
189 tfid.volume = fidp->Volume;
190 cm_RecordRacingRevoke(&tfid, CM_RACINGFLAG_CANCELVOL);
192 osi_Log1(afsd_logp, "Revoke Volume %d", fidp->Volume);
194 lock_ObtainWrite(&cm_scacheLock);
195 for(hash = 0; hash < cm_hashTableSize; hash++) {
196 for(scp=cm_hashTablep[hash]; scp; scp=scp->nextp) {
197 if (scp->fid.volume == fidp->Volume) {
199 lock_ReleaseWrite(&cm_scacheLock);
200 lock_ObtainMutex(&scp->mx);
201 cm_DiscardSCache(scp);
202 lock_ReleaseMutex(&scp->mx);
203 cm_CallbackNotifyChange(scp);
204 lock_ObtainWrite(&cm_scacheLock);
207 } /* search one hash bucket */
208 } /* search all hash buckets */
210 lock_ReleaseWrite(&cm_scacheLock);
213 /* handle incoming RPC callback breaking message.
214 * Called with no locks held.
216 SRXAFSCB_CallBack(struct rx_call *callp, AFSCBFids *fidsArrayp, AFSCBs *cbsArrayp)
221 for(i=0; i < (long) fidsArrayp->AFSCBFids_len; i++) {
222 tfidp = &fidsArrayp->AFSCBFids_val[i];
224 if (tfidp->Volume == 0) continue; /* means don't do anything */
225 else if (tfidp->Vnode == 0)
226 cm_RevokeVolumeCallback(callp, tfidp);
227 else cm_RevokeCallback(callp, tfidp);
233 /* called with no locks by RPC system when a server indicates that it has never
234 * heard from us, or for other reasons has had to discard callbacks from us
235 * without telling us, e.g. a network partition.
237 SRXAFSCB_InitCallBackState(struct rx_call *callp)
239 struct sockaddr_in taddr;
245 if ((rx_ConnectionOf(callp)) && (rx_PeerOf(rx_ConnectionOf(callp)))) {
246 taddr.sin_family = AF_INET;
247 taddr.sin_addr.s_addr = rx_HostOf(rx_PeerOf(rx_ConnectionOf(callp)));
249 tsp = cm_FindServer(&taddr, CM_SERVER_FILE);
251 osi_Log1(afsd_logp, "Init Callback State server %x", tsp);
253 /* record the callback in the racing revokes structure. This
254 * shouldn't be necessary, since we shouldn't be making callback
255 * granting calls while we're going to get an initstate call,
256 * but there probably are some obscure races, so better safe
259 * We do this first since we don't hold the cm_scacheLock and vnode
260 * locks over the entire callback scan operation below. The
261 * big loop below is guaranteed to hit any callback already
262 * processed. The call to RecordRacingRevoke is guaranteed
263 * to kill any callback that is currently being returned.
264 * Anything that sneaks past both must start
265 * after the call to RecordRacingRevoke.
267 cm_RecordRacingRevoke(NULL, CM_RACINGFLAG_CANCELALL);
269 /* now search all vnodes looking for guys with this callback, if we
270 * found it, or guys with any callbacks, if we didn't find the server
271 * (that's how multihomed machines will appear and how we'll handle
272 * them, albeit a little inefficiently). That is, we're discarding all
273 * callbacks from all hosts if we get an initstate call from an unknown
274 * host. Since these calls are rare, and multihomed servers
275 * are "rare," hopefully this won't be a problem.
277 lock_ObtainWrite(&cm_scacheLock);
278 for(hash = 0; hash < cm_hashTableSize; hash++) {
279 for(scp=cm_hashTablep[hash]; scp; scp=scp->nextp) {
281 lock_ReleaseWrite(&cm_scacheLock);
282 lock_ObtainMutex(&scp->mx);
284 if (scp->cbServerp != NULL) {
285 /* we have a callback, now decide if we should clear it */
286 if (scp->cbServerp == tsp || tsp == NULL) {
287 cm_DiscardSCache(scp);
291 lock_ReleaseMutex(&scp->mx);
293 cm_CallbackNotifyChange(scp);
294 lock_ObtainWrite(&cm_scacheLock);
296 } /* search one hash bucket */
297 } /* search all hash buckets */
299 lock_ReleaseWrite(&cm_scacheLock);
301 /* we're done with the server structure */
302 if (tsp) cm_PutServer(tsp);
308 /* just returns if we're up */
309 SRXAFSCB_Probe(struct rx_call *callp)
314 /* debug interface: not implemented */
315 SRXAFSCB_GetCE64(struct rx_call *callp, long index, AFSDBCacheEntry *cep)
321 /* debug interface: not implemented */
322 SRXAFSCB_GetLock(struct rx_call *callp, long index, AFSDBLock *lockp)
328 /* debug interface: not implemented */
329 SRXAFSCB_GetCE(struct rx_call *callp, long index, AFSDBCacheEntry *cep)
335 /* debug interface: not implemented */
336 SRXAFSCB_XStatsVersion(struct rx_call *callp, long *vp)
343 /* debug interface: not implemented */
344 SRXAFSCB_GetXStats(struct rx_call *callp, long cvn, long coln, long *srvp, long *timep,
345 AFSCB_CollData *datap)
351 /* debug interface: not implemented */
352 SRXAFSCB_InitCallBackState2(struct rx_call *callp, struct interfaceAddr* addr)
358 /* debug interface: not implemented */
359 SRXAFSCB_WhoAreYou(struct rx_call *callp, struct interfaceAddr* addr)
365 /* debug interface: not implemented */
366 SRXAFSCB_InitCallBackState3(struct rx_call *callp, afsUUID* serverUuid)
372 /* debug interface: not implemented */
373 SRXAFSCB_ProbeUuid(struct rx_call *callp, afsUUID* clientUuid)
379 /*------------------------------------------------------------------------
380 * EXPORTED SRXAFSCB_GetServerPrefs
383 * Routine to list server preferences used by this client.
386 * a_call : Ptr to Rx call on which this request came in.
387 * a_index : Input server index
388 * a_srvr_addr : Output server address (0xffffffff on last server)
389 * a_srvr_rank : Output server rank
395 * Nothing interesting.
399 *------------------------------------------------------------------------*/
401 int SRXAFSCB_GetServerPrefs(
402 struct rx_call *a_call,
404 afs_int32 *a_srvr_addr,
405 afs_int32 *a_srvr_rank)
407 *a_srvr_addr = 0xffffffff;
408 *a_srvr_rank = 0xffffffff;
412 /*------------------------------------------------------------------------
413 * EXPORTED SRXAFSCB_GetCellServDB
416 * Routine to list cells configured for this client
419 * a_call : Ptr to Rx call on which this request came in.
420 * a_index : Input cell index
421 * a_name : Output cell name ("" on last cell)
422 * a_hosts : Output cell database servers
428 * Nothing interesting.
432 *------------------------------------------------------------------------*/
434 int SRXAFSCB_GetCellServDB(
435 struct rx_call *a_call,
442 t_name = (char *)malloc(AFSNAMEMAX);
445 a_hosts->serverList_len = 0;
449 /*------------------------------------------------------------------------
450 * EXPORTED SRXAFSCB_GetLocalCell
453 * Routine to return name of client's local cell
456 * a_call : Ptr to Rx call on which this request came in.
457 * a_name : Output cell name
463 * Nothing interesting.
467 *------------------------------------------------------------------------*/
469 int SRXAFSCB_GetLocalCell(
470 struct rx_call *a_call,
476 t_name = (char *)malloc(strlen(cm_rootCellp->namep)+1);
477 strcpy(t_name, cm_rootCellp->namep);
479 t_name = (char *)malloc(1);
488 * afs_MarshallCacheConfig - marshall client cache configuration
492 * IN callerVersion - the rpc stat version of the caller.
494 * IN config - client cache configuration.
496 * OUT ptr - buffer where configuration is marshalled.
502 static void afs_MarshallCacheConfig(
503 afs_uint32 callerVersion,
504 cm_initparams_v1 *config,
508 * We currently only support version 1.
510 *(ptr++) = config->nChunkFiles;
511 *(ptr++) = config->nStatCaches;
512 *(ptr++) = config->nDataCaches;
513 *(ptr++) = config->nVolumeCaches;
514 *(ptr++) = config->firstChunkSize;
515 *(ptr++) = config->otherChunkSize;
516 *(ptr++) = config->cacheSize;
517 *(ptr++) = config->setTime;
518 *(ptr++) = config->memCache;
523 /*------------------------------------------------------------------------
524 * EXPORTED SRXAFSCB_GetCacheConfig
527 * Routine to return parameters used to initialize client cache.
528 * Client may request any format version. Server may not return
529 * format version greater than version requested by client.
532 * a_call: Ptr to Rx call on which this request came in.
533 * callerVersion: Data format version desired by the client.
534 * serverVersion: Data format version of output data.
535 * configCount: Number bytes allocated for output data.
536 * config: Client cache configuration.
542 * Nothing interesting.
546 *------------------------------------------------------------------------*/
548 int SRXAFSCB_GetCacheConfig(a_call, callerVersion, serverVersion,
550 struct rx_call *a_call;
551 afs_uint32 callerVersion;
552 afs_uint32 *serverVersion;
553 afs_uint32 *configCount;
556 afs_uint32 *t_config;
558 extern cm_initparams_v1 cm_initParams;
561 * Currently only support version 1
563 allocsize = sizeof(cm_initparams_v1);
564 t_config = (afs_uint32 *)malloc(allocsize);
566 afs_MarshallCacheConfig(callerVersion, &cm_initParams, t_config);
568 *serverVersion = AFS_CLIENT_RETRIEVAL_FIRST_EDITION;
569 *configCount = allocsize;
570 config->cacheConfig_val = t_config;
571 config->cacheConfig_len = allocsize/sizeof(afs_uint32);
576 /* called by afsd without any locks to initialize this module */
577 void cm_InitCallback(void)
579 lock_InitializeRWLock(&cm_callbackLock, "cm_callbackLock");
580 cm_activeCallbackGrantingCalls = 0;
583 /* called with locked scp; tells us whether we've got a callback.
584 * Expirations are checked by a background daemon so as to make
585 * this function as inexpensive as possible
587 int cm_HaveCallback(cm_scache_t *scp)
589 #ifdef AFS_FREELANCE_CLIENT
590 // yj: we handle callbacks specially for callbacks on the root directory
591 // Since it's local, we almost always say that we have callback on it
592 // The only time we send back a 0 is if we're need to initialize or
593 // reinitialize the fake directory
595 // There are 2 state variables cm_fakeGettingCallback and cm_fakeDirCallback
596 // cm_fakeGettingCallback is 1 if we're in the process of initialization and
597 // hence should return false. it's 0 otherwise
598 // cm_fakeDirCallback is 0 if we haven't loaded the fake directory, it's 1
599 // if the fake directory is loaded and this is the first time cm_HaveCallback
600 // is called since then. We return false in this case to allow cm_GetCallback
601 // to be called because cm_GetCallback has some initialization work to do.
602 // If cm_fakeDirCallback is 2, then it means that the fake directory is in
603 // good shape and we simply return true, provided no change is detected.
606 if (cm_freelanceEnabled && scp->fid.cell==0x1 && scp->fid.volume==0x20000001) { // if it's something on /afs
607 if (!(scp->fid.vnode==0x1 && scp->fid.unique==0x1)) // if it's not root.afs
610 lock_ObtainMutex(&cm_Freelance_Lock);
611 fdc = cm_fakeDirCallback;
612 fgc = cm_fakeGettingCallback;
613 lock_ReleaseMutex(&cm_Freelance_Lock);
615 if (fdc==1) { // first call since init
617 } else if (fdc==2 && !fgc) { // we're in good shape
618 if (cm_getLocalMountPointChange()) { // check for changes
619 cm_clearLocalMountPointChange(); // clear the changefile
620 cm_reInitLocalMountPoints(); // start reinit
623 return 1; // no change
630 if (scp->cbServerp != NULL)
635 /* need to detect a broken callback that races with our obtaining a callback.
636 * Need to be able to do this even if we don't know the file ID of the file
637 * we're breaking the callback on at the time we start the acquisition of the
638 * callback (as in the case where we are creating a file).
640 * So, we start by writing down the count of the # of callbacks we've received
641 * so far, and bumping a global counter of the # of callback granting calls
642 * outstanding (all done under cm_callbackLock).
644 * When we're back from the call, we look at all of the callback revokes with
645 * counter numbers greater than the one we recorded in our caller's structure,
646 * and replay those that are higher than when we started the call.
648 * We free all the structures in the queue when the count of the # of outstanding
649 * callback-granting calls drops to zero.
651 * We call this function with the scp locked, too, but in its current implementation,
652 * this knowledge is not used.
654 void cm_StartCallbackGrantingCall(cm_scache_t *scp, cm_callbackRequest_t *cbrp)
656 lock_ObtainWrite(&cm_callbackLock);
657 cbrp->callbackCount = cm_callbackCount;
658 cm_activeCallbackGrantingCalls++;
659 cbrp->startTime = osi_Time();
660 cbrp->serverp = NULL;
661 lock_ReleaseWrite(&cm_callbackLock);
664 /* Called at the end of a callback-granting call, to remove the callback
665 * info from the scache entry, if necessary.
667 * Called with scp locked, so we can discard the callbacks easily with
668 * this locking hierarchy.
670 void cm_EndCallbackGrantingCall(cm_scache_t *scp, cm_callbackRequest_t *cbrp,
671 AFSCallBack *cbp, long flags)
673 cm_racingRevokes_t *revp; /* where we are */
674 cm_racingRevokes_t *nrevp; /* where we'll be next */
677 lock_ObtainWrite(&cm_callbackLock);
678 if (flags & CM_CALLBACK_MAINTAINCOUNT) {
679 osi_assert(cm_activeCallbackGrantingCalls > 0);
682 osi_assert(cm_activeCallbackGrantingCalls-- > 0);
684 if (cm_activeCallbackGrantingCalls == 0) freeFlag = 1;
687 /* record the callback; we'll clear it below if we really lose it */
689 scp->cbServerp = cbrp->serverp;
690 scp->cbExpires = cbrp->startTime + cbp->ExpirationTime;
693 /* a callback was actually revoked during our granting call, so
694 * run down the list of revoked fids, looking for ours.
695 * If activeCallbackGrantingCalls is zero, free the elements, too.
697 * May need to go through entire list just to do the freeing.
699 for(revp = cm_racingRevokesp; revp; revp = nrevp) {
700 nrevp = (cm_racingRevokes_t *) osi_QNext(&revp->q);
701 /* if this callback came in later than when we started the
702 * callback-granting call, and if this fid is the right fid,
703 * then clear the callback.
705 if (scp && cbrp->callbackCount != cm_callbackCount
706 && revp->callbackCount > cbrp->callbackCount
708 (scp->fid.volume == revp->fid.volume &&
709 scp->fid.vnode == revp->fid.vnode &&
710 scp->fid.unique == revp->fid.unique)
712 ((revp->flags & CM_RACINGFLAG_CANCELVOL) &&
713 scp->fid.volume == revp->fid.volume)
715 (revp->flags & CM_RACINGFLAG_CANCELALL))) {
716 /* this one matches */
718 "Racing revoke scp %x old cbc %d rev cbc %d cur cbc %d",
720 cbrp->callbackCount, revp->callbackCount,
722 cm_DiscardSCache(scp);
724 * Since we don't have a callback to preserve, it's
725 * OK to drop the lock and re-obtain it.
727 lock_ReleaseMutex(&scp->mx);
728 cm_CallbackNotifyChange(scp);
729 lock_ObtainMutex(&scp->mx);
731 if (freeFlag) free(revp);
734 /* if we freed the list, zap the pointer to it */
735 if (freeFlag) cm_racingRevokesp = NULL;
737 lock_ReleaseWrite(&cm_callbackLock);
740 /* if flags is 1, we want to force the code to make one call, anyway.
741 * called with locked scp; returns with same.
743 long cm_GetCallback(cm_scache_t *scp, struct cm_user *userp,
744 struct cm_req *reqp, long flags)
748 AFSFetchStatus afsStatus;
750 AFSCallBack callback;
752 cm_callbackRequest_t cbr;
756 #ifdef AFS_FREELANCE_CLIENT
758 // The case where a callback is needed on /afs is handled
759 // specially. We need to fetch the status by calling
760 // cm_MergeStatus and mark that cm_fakeDirCallback is 2
761 if (cm_freelanceEnabled &&
762 scp->fid.cell==0x1 &&
763 scp->fid.volume==0x20000001 &&
764 scp->fid.unique==0x1 &&
765 scp->fid.vnode==0x1) {
766 // Start by indicating that we're in the process
767 // of fetching the callback
769 lock_ObtainMutex(&cm_Freelance_Lock);
770 cm_fakeGettingCallback = 1;
771 lock_ReleaseMutex(&cm_Freelance_Lock);
773 // Fetch the status info
774 cm_MergeStatus(scp, &afsStatus, &volSync, userp, 0);
776 // Indicate that the callback is not done
777 lock_ObtainMutex(&cm_Freelance_Lock);
778 cm_fakeDirCallback = 2;
779 // Indicate that we're no longer fetching the callback
780 cm_fakeGettingCallback = 0;
781 lock_ReleaseMutex(&cm_Freelance_Lock);
786 /*if (scp->fid.cell==0x1 && scp->fid.volume==0x20000001) {
787 afsi_log("cm_getcallback should NEVER EVER get here... ");
789 // yj: end of getcallback modifications ---------------
791 #endif /* AFS_FREELANCE_CLIENT */
793 mustCall = (flags & 1);
794 cm_AFSFidFromFid(&tfid, &scp->fid);
796 if (!mustCall && cm_HaveCallback(scp)) return 0;
798 /* turn off mustCall, since it has now forced us past the check above */
801 /* otherwise, we have to make an RPC to get the status */
802 sflags = CM_SCACHESYNC_FETCHSTATUS | CM_SCACHESYNC_GETCALLBACK;
803 cm_SyncOp(scp, NULL, NULL, NULL, 0, sflags);
804 cm_StartCallbackGrantingCall(scp, &cbr);
805 lock_ReleaseMutex(&scp->mx);
807 /* now make the RPC */
808 osi_Log1(afsd_logp, "CALL FetchStatus vp %x", (long) scp);
810 code = cm_Conn(&scp->fid, userp, reqp, &connp);
813 code = RXAFS_FetchStatus(connp->callp, &tfid,
814 &afsStatus, &callback, &volSync);
816 } while (cm_Analyze(connp, userp, reqp, &scp->fid, &volSync,
818 code = cm_MapRPCError(code, reqp);
819 osi_Log0(afsd_logp, "CALL FetchStatus DONE");
821 lock_ObtainMutex(&scp->mx);
822 cm_SyncOpDone(scp, NULL, sflags);
824 cm_EndCallbackGrantingCall(scp, &cbr, &callback, 0);
825 cm_MergeStatus(scp, &afsStatus, &volSync, userp, 0);
828 cm_EndCallbackGrantingCall(NULL, NULL, NULL, 0);
830 /* now check to see if we got an error */
831 if (code) return code;
835 /* called periodically by cm_daemon to shut down use of expired callbacks */
836 void cm_CheckCBExpiration(void)
843 lock_ObtainWrite(&cm_scacheLock);
844 for(i=0; i<cm_hashTableSize; i++) {
845 for(scp = cm_hashTablep[i]; scp; scp=scp->nextp) {
847 lock_ReleaseWrite(&cm_scacheLock);
848 lock_ObtainMutex(&scp->mx);
849 if (scp->cbServerp && now > scp->cbExpires) {
850 cm_DiscardSCache(scp);
852 lock_ReleaseMutex(&scp->mx);
853 lock_ObtainWrite(&cm_scacheLock);
854 osi_assert(scp->refCount-- > 0);
857 lock_ReleaseWrite(&cm_scacheLock);