From 393820794c45b72a530b30bfd96aac982310eb7e Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Sat, 20 Mar 2010 10:59:20 -0400 Subject: [PATCH] multibreak callbacks add host marking to deal with refcounts, we have to mark hosts in a way other than holds. do so. all other h_Enum callers don't use this feature. FIXES 126497 Change-Id: I0fc008495b93d2c361d476c7fcb6b355c0dab825 Change-Id: I61128261b2e8c64fafbf7425d6a65dd48fd7e177 Reviewed-on: http://gerrit.openafs.org/1599 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/viced/callback.c | 22 +++++++++++++--------- src/viced/host.h | 1 + 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/viced/callback.c b/src/viced/callback.c index 9cfd1d50c..0ecb5c45b 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -1125,11 +1125,12 @@ MultiBreakVolumeCallBack_r(struct host *host, int isheld, { char hoststr[16]; - if (!isheld) - return isheld; /* host is held only by h_Enumerate, do nothing */ if (host->hostFlags & HOSTDELETED) return 0; /* host is deleted, release hold */ + if (!(host->hostFlags & HCBREAK)) + return 0; /* host is not flagged to notify */ + if (host->hostFlags & VENUSDOWN) { h_Lock_r(host); /* Do not care if the host is now HOSTDELETED */ @@ -1144,9 +1145,9 @@ MultiBreakVolumeCallBack_r(struct host *host, int isheld, * selectively remember to * delete the volume callbacks * later */ - host->hostFlags &= ~RESETDONE; /* Do InitCallBackState when host returns */ + host->hostFlags &= ~(RESETDONE|HCBREAK); /* Do InitCallBackState when host returns */ h_Unlock_r(host); - return 0; /* release hold */ + return 0; /* parent will release hold */ } assert(parms->ncbas <= MAX_CB_HOSTS); @@ -1166,7 +1167,8 @@ MultiBreakVolumeCallBack_r(struct host *host, int isheld, } parms->cba[parms->ncbas].hp = host; parms->cba[(parms->ncbas)++].thead = parms->thead; - return 1; /* DON'T release hold, because we still need it. */ + host->hostFlags &= ~HCBREAK; + return 1; /* parent shouldn't release hold, more work to do */ } /* @@ -1236,7 +1238,8 @@ BreakVolumeCallBacks(afs_uint32 volume) host = h_itoh(cb->hhead); if (!(host->hostFlags & HOSTDELETED)) { - h_Hold_r(host); + /* mark this host for notification */ + host->hostFlags |= HCBREAK; if (!tthead || (TNorm(tthead) < TNorm(cb->thead))) { tthead = cb->thead; } @@ -1245,7 +1248,7 @@ BreakVolumeCallBacks(afs_uint32 volume) TDel(cb); HDel(cb); FreeCB(cb); - /* leave hold for MultiBreakVolumeCallBack to clear */ + /* leave flag for MultiBreakVolumeCallBack to clear */ } *feip = fe->fnext; FreeFE(fe); @@ -1389,7 +1392,8 @@ BreakLaterCallBacks(void) host = h_itoh(cb->hhead); if (cb->status == CB_DELAYED) { if (!(host->hostFlags & HOSTDELETED)) { - h_Hold_r(host); + /* mark this host for notification */ + host->hostFlags |= HCBREAK; if (!tthead || (TNorm(tthead) < TNorm(cb->thead))) { tthead = cb->thead; } @@ -1397,7 +1401,7 @@ BreakLaterCallBacks(void) TDel(cb); HDel(cb); CDel(cb, 0); /* Don't let CDel clean up the fe */ - /* leave hold for MultiBreakVolumeCallBack to clear */ + /* leave flag for MultiBreakVolumeCallBack to clear */ } else { ViceLog(125, ("Found host %p (%s:%d) non-DELAYED cb for %u:%u:%u\n", diff --git a/src/viced/host.h b/src/viced/host.h index 73e5dd418..9c82d5a13 100644 --- a/src/viced/host.h +++ b/src/viced/host.h @@ -292,4 +292,5 @@ struct host *(hosttableptrs[h_MAXHOSTTABLES]); /* Used by h_itoh */ #define HFE_LATER 0x80 /* host has FE_LATER callbacks */ #define HERRORTRANS 0x100 /* do error translation */ #define HWHO_INPROGRESS 0x200 /* set when WhoAreYou running */ +#define HCBREAK 0x400 /* flag for a multi CB break */ #endif /* _AFS_VICED_HOST_H */ -- 2.39.5