From 3edb993a8dd92ea7edb0fb13c7d5391604e9cdc1 Mon Sep 17 00:00:00 2001 From: Marc Dionne Date: Sun, 22 Jan 2012 09:45:22 -0500 Subject: [PATCH] viced: Allow null host for BreakCallBack For replication writes at the remote site, we will want to call this without a host structure. Reviewed-on: http://gerrit.openafs.org/6674 Reviewed-by: Simon Wilkinson Tested-by: BuildBot Reviewed-by: Derrick Brashear (cherry picked from commit 01301d0a5323a836efaae30cac325c25f6a7577a) Change-Id: I1fb0dff655515fedd7dfb41139f1fb6c85599377 Reviewed-on: http://gerrit.openafs.org/6753 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/viced/callback.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/viced/callback.c b/src/viced/callback.c index 40bebec69..79aef542f 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -812,10 +812,15 @@ BreakCallBack(struct host *xhost, AFSFid * fid, int flag) int hostindex; char hoststr[16]; - ViceLog(7, - ("BCB: BreakCallBack(Host %p all but %s:%d, (%u,%u,%u))\n", - xhost, afs_inet_ntoa_r(xhost->host, hoststr), ntohs(xhost->port), - fid->Volume, fid->Vnode, fid->Unique)); + if (xhost) + ViceLog(7, + ("BCB: BreakCallBack(Host %p all but %s:%d, (%u,%u,%u))\n", + xhost, afs_inet_ntoa_r(xhost->host, hoststr), ntohs(xhost->port), + fid->Volume, fid->Vnode, fid->Unique)); + else + ViceLog(7, + ("BCB: BreakCallBack(No Host, (%u,%u,%u))\n", + fid->Volume, fid->Vnode, fid->Unique)); H_LOCK; cbstuff.BreakCallBacks++; @@ -823,7 +828,7 @@ BreakCallBack(struct host *xhost, AFSFid * fid, int flag) if (!fe) { goto done; } - hostindex = h_htoi(xhost); + hostindex = xhost ? h_htoi(xhost) : 0; cb = itocb(fe->firstcb); if (!cb || ((fe->ncbs == 1) && (cb->hhead == hostindex) && !flag)) { /* the most common case is what follows the || */ -- 2.39.5