From 2ab0b6a488ad2a591eac6b006dd7cd8d1212494a Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Fri, 25 Feb 2005 19:50:25 +0000 Subject: [PATCH] STABLE14-cblater-protection-and-paranoia-20050225 with additional fix from jaltman for case where we need to get a fresh fe. don't reuse FE_LATER file entries. (cherry picked from commit c9b63162b696589b6772847038f73bfd5d1df896) --- src/viced/callback.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/viced/callback.c b/src/viced/callback.c index 1ad0a2890..12caaea4f 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -328,7 +328,7 @@ FindFE(register AFSFid * fid) for (fei = HashTable[hash]; fei; fei = fe->fnext) { fe = itofe(fei); if (fe->volid == fid->Volume && fe->unique == fid->Unique - && fe->vnode == fid->Vnode) + && fe->vnode == fid->Vnode && fe->status != FE_LATER) return fe; } return 0; @@ -721,6 +721,11 @@ AddCallBack1_r(struct host *host, AFSFid * fid, afs_uint32 * thead, int type, TDel(cb); TAdd(cb, Thead); } + if (newfe == NULL) { /* we are using the new FE */ + fe->firstcb = cbtoi(cb); + fe->ncbs++; + cb->fhead = fetoi(fe); + } } else { cb = newcb; newcb = NULL; @@ -1422,6 +1427,7 @@ BreakLaterCallBacks(void) struct host *host; struct VCBParams henumParms; unsigned short tthead = 0; /* zero is illegal value */ + char hoststr[16]; /* Unchain first */ ViceLog(25, ("Looking for FileEntries to unchain\n")); @@ -1461,16 +1467,23 @@ BreakLaterCallBacks(void) 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; + host = h_itoh(cb->hhead); + if (cb->status == CB_DELAYED) { + h_Hold_r(host); + 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 */ + } else { + ViceLog(125, + ("Found host %s:%d non-DELAYED cb for %u:%u:%u\n", + afs_inet_ntoa_r(host->host, hoststr), + ntohs(host->port), fe->vnode, fe->unique, fe->volid)); } - TDel(cb); - HDel(cb); - CDel(cb, 0); /* Don't let CDel clean up the fe */ - /* leave hold for MultiBreakVolumeCallBack to clear */ } myfe = fe; fe = (struct FileEntry *)((struct object *)fe)->next; -- 2.39.5