afs_inet_ntoa_r(thost->host, hoststr)));
if ( MultiProbeAlternateAddress_r (thost) ) {
ViceLog(0, ("MultiProbe failed to find new address for host %s:%d\n",
- afs_inet_ntoa_r(thost->host, hoststr), thost->port));
+ afs_inet_ntoa_r(thost->host, hoststr),
+ ntohs(thost->port)));
code = -1;
} else {
ViceLog(0, ("MultiProbe found new address for host %s:%d\n",
- afs_inet_ntoa_r(thost->host, hoststr), thost->port));
+ afs_inet_ntoa_r(thost->host, hoststr),
+ ntohs(thost->port)));
if (BreakDelayedCallBacks_r(thost)) {
ViceLog(0,("BreakDelayedCallbacks FAILED AGAIN for host %s which IS UP. Possible network or routing failure.\n",
afs_inet_ntoa_r(thost->host, hoststr)));
/* I'm not really worried about when we restarted, I'm */
/* just worried about when the first VBUSY was returned. */
TM_GetTimeOfDay(&restartedat, 0);
- return(VBUSY);
+ return(busyonrst?VBUSY:VRESTARTING);
}
else {
struct timeval now;
TM_GetTimeOfDay(&now, 0);
if ((now.tv_sec - restartedat.tv_sec) < (11*60)) {
- return(VBUSY);
+ return(busyonrst?VBUSY:VRESTARTING);
}
else {
return (VRESTARTING);
/* now allocate and copy these things; they're freed by the RXGEN stub */
temp = strlen(V_name(volptr)) + 1;
*name = malloc(temp);
+ if (!*name) {
+ ViceLog(0, ("Failed malloc in RXGetVolumeStatus\n"));
+ assert(0);
+ }
strcpy(*name, V_name(volptr));
temp = strlen(V_offlineMessage(volptr)) + 1;
*offMsg = malloc(temp);
+ if (!*offMsg) {
+ ViceLog(0, ("Failed malloc in RXGetVolumeStatus\n"));
+ assert(0);
+ }
strcpy(*offMsg, V_offlineMessage(volptr));
#if TRANSARC_VOL_STATS
*motd = malloc(1);
+ if (!*motd) {
+ ViceLog(0, ("Failed malloc in RXGetVolumeStatus\n"));
+ assert(0);
+ }
strcpy(*motd, nullString);
#else
temp = strlen(V_motd(volptr)) + 1;
*motd = malloc(temp);
+ if (!*motd) {
+ ViceLog(0, ("Failed malloc in RXGetVolumeStatus\n"));
+ assert(0);
+ }
strcpy(*motd, V_motd(volptr));
#endif /* FS_STATS_DETAILED */
FS_LOCK
afs_buffersAlloced++;
if (!freeBufferList) {
+ char *tmp;
FS_UNLOCK
- return malloc(sendBufSize);
+
+ tmp = malloc(sendBufSize);
+ if (!tmp) {
+ ViceLog(0, ("Failed malloc in AllocSendBuffer\n"));
+ assert(0);
+ }
+ return tmp;
}
tp = freeBufferList;
freeBufferList = tp->next;
AccessList->AFSOpaque_len = 0;
AccessList->AFSOpaque_val = malloc(AFSOPAQUEMAX);
+ if (!AccessList->AFSOpaque_val) {
+ ViceLog(0, ("Failed malloc in SRXAFS_FetchACL\n"));
+ assert(0);
+ }
/*
* Get volume/vnode for the fetched file; caller's access rights to it
/* allocate space for return output parameters */
OutStats->AFSBulkStats_val = (struct AFSFetchStatus *)
malloc(nfiles * sizeof(struct AFSFetchStatus));
+ if (!OutStats->AFSBulkStats_val) {
+ ViceLog(0, ("Failed malloc in SRXAFS_BulkStatus\n"));
+ assert(0);
+ }
OutStats->AFSBulkStats_len = nfiles;
CallBacks->AFSCBs_val = (struct AFSCallBack *)
malloc(nfiles * sizeof(struct AFSCallBack));
+ if (!CallBacks->AFSCBs_val) {
+ ViceLog(0, ("Failed malloc in SRXAFS_BulkStatus\n"));
+ assert(0);
+ }
CallBacks->AFSCBs_len = nfiles;
if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon)))
/* allocate space for return output parameters */
OutStats->AFSBulkStats_val = (struct AFSFetchStatus *)
malloc(nfiles * sizeof(struct AFSFetchStatus));
+ if (!OutStats->AFSBulkStats_val) {
+ ViceLog(0, ("Failed malloc in SRXAFS_FetchStatus\n"));
+ assert(0);
+ }
OutStats->AFSBulkStats_len = nfiles;
CallBacks->AFSCBs_val = (struct AFSCallBack *)
malloc(nfiles * sizeof(struct AFSCallBack));
+ if (!CallBacks->AFSCBs_val) {
+ ViceLog(0, ("Failed malloc in SRXAFS_FetchStatus\n"));
+ assert(0);
+ }
CallBacks->AFSCBs_len = nfiles;
if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon))) {
} /*SRXAFS_GetXStats*/
-afs_int32 SRXAFS_GiveUpCallBacks (struct rx_call *acall,
- struct AFSCBFids *FidArray,
- struct AFSCBs *CallBackArray)
+static afs_int32 common_GiveUpCallBacks (struct rx_call *acall,
+ struct AFSCBFids *FidArray,
+ struct AFSCBs *CallBackArray)
{
afs_int32 errorCode;
register int i;
if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon)))
goto Bad_GiveUpCallBacks;
- if (FidArray->AFSCBFids_len < CallBackArray->AFSCBs_len) {
- ViceLog(0, ("GiveUpCallBacks: #Fids %d < #CallBacks %d, host=%x\n",
- FidArray->AFSCBFids_len, CallBackArray->AFSCBs_len,
- (tcon->peer ? tcon->peer->host : 0)));
- errorCode = EINVAL;
- goto Bad_GiveUpCallBacks;
- }
+ if (!FidArray && !CallBackArray) {
+ errorCode = GetClient(tcon, &client);
+ if (!errorCode)
+ DeleteAllCallBacks_r(client->host, 1);
+ } else {
+ if (FidArray->AFSCBFids_len < CallBackArray->AFSCBs_len) {
+ ViceLog(0, ("GiveUpCallBacks: #Fids %d < #CallBacks %d, host=%x\n",
+ FidArray->AFSCBFids_len, CallBackArray->AFSCBs_len,
+ (tcon->peer ? tcon->peer->host : 0)));
+ errorCode = EINVAL;
+ goto Bad_GiveUpCallBacks;
+ }
- errorCode = GetClient(tcon, &client);
- if (!errorCode) {
- for (i=0; i < FidArray->AFSCBFids_len; i++) {
- register struct AFSFid *fid = &(FidArray->AFSCBFids_val[i]);
- DeleteCallBack(client->host, fid);
- }
+ errorCode = GetClient(tcon, &client);
+ if (!errorCode) {
+ for (i=0; i < FidArray->AFSCBFids_len; i++) {
+ register struct AFSFid *fid = &(FidArray->AFSCBFids_val[i]);
+ DeleteCallBack(client->host, fid);
+ }
+ }
}
Bad_GiveUpCallBacks:
out:
return errorCode;
+} /*common_GiveUpCallBacks*/
+
+
+afs_int32 SRXAFS_GiveUpCallBacks (struct rx_call *acall,
+ struct AFSCBFids *FidArray,
+ struct AFSCBs *CallBackArray)
+{
+ return common_GiveUpCallBacks(acall, FidArray, CallBackArray);
} /*SRXAFS_GiveUpCallBacks*/
+afs_int32 SRXAFS_GiveUpAllCallBacks (struct rx_call *acall)
+{
+ return common_GiveUpCallBacks(acall, 0, 0);
+} /*SRXAFS_GiveUpAllCallBacks*/
+
afs_int32 SRXAFS_NGetVolumeInfo (struct rx_call *acall,
char *avolid,
if ((client->ViceId != ANONYMOUSID) && client->CPS.prlist_val) {
free(client->CPS.prlist_val);
client->CPS.prlist_val = NULL;
+ client->CPS.prlist_len = 0;
}
ReleaseWriteLock(&client->lock);
}