viced: Allow null host for BreakCallBack
authorMarc Dionne <marc.c.dionne@gmail.com>
Sun, 22 Jan 2012 14:45:22 +0000 (09:45 -0500)
committerDerrick Brashear <shadow@dementix.org>
Thu, 23 Feb 2012 01:45:40 +0000 (17:45 -0800)
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 <simonxwilkinson@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 01301d0a5323a836efaae30cac325c25f6a7577a)

Change-Id: I1fb0dff655515fedd7dfb41139f1fb6c85599377
Reviewed-on: http://gerrit.openafs.org/6753
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

src/viced/callback.c

index 40bebec..79aef54 100644 (file)
@@ -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 || */