ViceLog(7,
("BCB: Failed on file %u.%d.%d, host %s:%d is down\n",
afidp->AFSCBFids_val->Volume, afidp->AFSCBFids_val->Vnode,
- afidp->AFSCBFids_val->Unique, afs_inet_ntoa_r(hp->host,hoststr), hp->port));
+ afidp->AFSCBFids_val->Unique, afs_inet_ntoa_r(hp->host,hoststr), ntohs(hp->port)));
}
H_LOCK
char hoststr[16];
ViceLog(7,("BCB: BreakCallBack(all but %s:%d, (%u,%d,%d))\n",
- afs_inet_ntoa_r(xhost->host,hoststr), xhost->port, fid->Volume, fid->Vnode,
+ afs_inet_ntoa_r(xhost->host,hoststr), ntohs(xhost->port), fid->Volume, fid->Vnode,
fid->Unique));
H_LOCK
}
else if (thishost->hostFlags & VENUSDOWN) {
ViceLog(7,("BCB: %s:%d is down; delaying break call back\n",
- afs_inet_ntoa_r(thishost->host,hoststr), thishost->port));
+ afs_inet_ntoa_r(thishost->host,hoststr), ntohs(thishost->port)));
cb->status = CB_DELAYED;
}
else {
pcb = FindCBPtr(fe, host);
if (!*pcb) {
ViceLog(8,("DCB: No call back for host %s:%d, (%u, %d, %d)\n",
- afs_inet_ntoa_r(host->host,hoststr), host->port, fid->Volume, fid->Vnode, fid->Unique));
+ afs_inet_ntoa_r(host->host,hoststr), ntohs(host->port), fid->Volume, fid->Vnode, fid->Unique));
h_Unlock_r(host);
H_UNLOCK
return 0;
if (ShowProblems) {
ViceLog(0,
("CB: Call back connect back failed (in break delayed) for %s:%d\n",
- afs_inet_ntoa_r(host->host,hoststr), host->port));
+ afs_inet_ntoa_r(host->host,hoststr), ntohs(host->port)));
}
host->hostFlags |= VENUSDOWN;
}
if (ShowProblems) {
ViceLog(0,
("CB: XCallBackBulk failed, host=%s:%d; callback list follows:\n",
- afs_inet_ntoa_r(host->host,hoststr), host->port));
+ afs_inet_ntoa_r(host->host,hoststr), ntohs(host->port)));
}
for (i = 0; i<nfids; i++) {
if (ShowProblems) {
ViceLog(0,
("CB: Host %s:%d, file %u.%u.%u (part of bulk callback)\n",
- afs_inet_ntoa_r(host->host,hoststr), host->port,
+ afs_inet_ntoa_r(host->host,hoststr), ntohs(host->port),
fids[i].Volume, fids[i].Vnode, fids[i].Unique));
}
/* used to do this:
return 0; /* Release hold */
}
ViceLog(8,("BVCB: volume call back for host %s:%d failed\n",
- afs_inet_ntoa_r(host->host,hoststr),host->port));
+ afs_inet_ntoa_r(host->host,hoststr),ntohs(host->port)));
if (ShowProblems) {
ViceLog(0, ("CB: volume callback for host %s:%d failed\n",
- afs_inet_ntoa_r(host->host,hoststr), host->port));
+ afs_inet_ntoa_r(host->host,hoststr), ntohs(host->port)));
}
DeleteAllCallBacks_r(host, deletefe); /* Delete all callback state
rather than attempting to
struct CallBack *cb;
struct FileEntry *fe = NULL;
struct FileEntry *myfe = NULL;
- struct FileEntry **fepp;
struct host *host;
struct VCBParams henumParms;
unsigned short tthead = 0; /* zero is illegal value */
/* Unchain first */
ViceLog(25, ("Looking for FileEntries to unchain\n"));
H_LOCK
-restart:
- tthead = 0;
+
+ /* Pick the first volume we see to clean up */
+ fid.Volume = fid.Vnode = fid.Unique = 0;
+
for (hash=0; hash<VHASH; hash++) {
for (feip = &HashTable[hash]; fe = itofe(*feip); ) {
- if (fe && fe->status & FE_LATER) {
+ if (fe && (fe->status & FE_LATER) &&
+ (fid.Volume == 0 || fid.Volume == fe->volid)) {
ViceLog(125, ("Unchaining for %d:%d:%d\n", fe->vnode,
fe->unique, fe->volid));
+ fid.Volume = fe->volid;
*feip = fe->fnext;
/* Works since volid is deeper than the largest pointer */
((struct object *)fe)->next = (struct object *)myfe;
myfe = fe;
- } else {
+ } else
feip = &fe->fnext;
- }
}
}
if (!myfe) {
- H_UNLOCK
- return 0;
+ H_UNLOCK
+ return 0;
}
- /* loop over myfe and free/break */
+ /* loop over FEs from myfe and free/break */
FSYNC_UNLOCK
- while (myfe) {
- /* Clear for next pass */
- fid.Volume = 0, fid.Vnode = fid.Unique = 0;
- tthead = 0;
- for (fepp = &myfe; fe = *fepp; ) {
- /* Pick up first volid we see and break callbacks for it */
- if (fid.Volume == 0 || fid.Volume == fe->volid) {
- register struct CallBack *cbnext;
- ViceLog(125, ("Caught volume %d for breaking\n", fe->volid));
- fid.Volume = fe->volid;
- for (cb = itocb(fe->firstcb); cb; cb = cbnext) {
- host = h_itoh(cb->hhead);
- h_Hold_r(host);
- cbnext = itocb(cb->cnext);
- if (!tthead || (TNorm(tthead) < TNorm(cb->thead))) {
- tthead = cb->thead;
- }
- TDel(cb);
- HDel(cb);
- FreeCB(cb);
- /* leave hold for MultiBreakVolumeCallBack to clear */
- }
- /* relink chain */
- (struct object *) *fepp = ((struct object *)fe)->next;
- FreeFE(fe);
- } else {
- (struct object **) fepp = &(((struct object *)fe)->next);
+ tthead = 0;
+ for (fe = myfe; fe; ) {
+ register struct CallBack *cbnext;
+ for (cb = itocb(fe->firstcb); cb; cb = cbnext) {
+ host = h_itoh(cb->hhead);
+ h_Hold_r(host);
+ cbnext = itocb(cb->cnext);
+ if (!tthead || (TNorm(tthead) < TNorm(cb->thead))) {
+ tthead = cb->thead;
}
+ TDel(cb);
+ HDel(cb);
+ CDel(cb, 0); /* Don't let CDel clean up the fe */
+ /* leave hold for MultiBreakVolumeCallBack to clear */
}
+ myfe = fe;
+ (struct object *)fe = ((struct object *)fe)->next;
+ FreeFE(myfe);
+ }
- if (tthead) {
- ViceLog(125, ("Breaking volume %d\n", fid.Volume));
+ if (tthead) {
+ ViceLog(125, ("Breaking volume %d\n", fid.Volume));
+ henumParms.ncbas = 0;
+ henumParms.fid = &fid;
+ henumParms.thead = tthead;
+ H_UNLOCK
+ h_Enumerate(MultiBreakVolumeLaterCallBack, (char *) &henumParms);
+ H_LOCK
+
+ if (henumParms.ncbas) { /* do left-overs */
+ struct AFSCBFids tf;
+ tf.AFSCBFids_len = 1;
+ tf.AFSCBFids_val = &fid;
+
+ MultiBreakCallBack_r(henumParms.cba, henumParms.ncbas, &tf, 0 );
henumParms.ncbas = 0;
- henumParms.fid = &fid;
- henumParms.thead = tthead;
- H_UNLOCK
- h_Enumerate(MultiBreakVolumeLaterCallBack, (char *) &henumParms);
- H_LOCK
-
- if (henumParms.ncbas) { /* do left-overs */
- struct AFSCBFids tf;
- tf.AFSCBFids_len = 1;
- tf.AFSCBFids_val = &fid;
-
- MultiBreakCallBack_r(henumParms.cba, henumParms.ncbas, &tf, 0 );
- henumParms.ncbas = 0;
- }
- }
- }
+ }
+ }
FSYNC_LOCK
-
- if (tthead) goto restart;
H_UNLOCK
+ /* Arrange to be called again */
return 1;
}