viced: Avoid issuing redundant TMAY requests
authorAndrew Deason <adeason@sinenomine.net>
Thu, 4 Apr 2013 22:35:01 +0000 (17:35 -0500)
committerDerrick Brashear <shadow@your-file-system.com>
Sun, 12 Jan 2014 19:55:16 +0000 (11:55 -0800)
commit9a0a8ca4d186cf953b87d9fae1a35f66090b060c
tree93d438ab7045032dcff46a5e11f495736b74689f
parent5c0a1d4acce78a582187b5ab3d0d4d60b97d7557
viced: Avoid issuing redundant TMAY requests

Currently, if a new Rx connection comes in from a host we already have
a host struct for, we make a TellMeAboutYourself (TMAY) call to the
given host, to verify the UUID (and caps, interface info, etc) is what
we expect it to be. That is, if it's still the "same" host that we
know about. This is necessary because we otherwise have no way of
telling if the Rx connection is from the same host, or from a new host
that just happens to have the same IP address (e.g. in the case that
hosts are moving around and changing IPs). We do this while the host
is locked, so we only issue these TMAY calls one at a time.

If a large number of Rx connections come in from the same host at
around the same time, this can result in a lot of TMAY requests being
issued against the host, even for hosts that never change IPs and
never do anything strange. In these situations, issuing so many TMAYs
is useless. If we have several calls waiting to lock the host to issue
a TMAY, some of the extra TMAY calls are provably useless. So instead
of calling TMAY repeatedly, remember what the last successful TMAY
result was, and reuse it for the "provably useless" calls.

Note that this 'cache' stores the actual raw results of
TellMeAboutYourself. We could save some memory by storing just how we
interpret that data later on in h_GetHost_r, but this way results in
way simpler h_GetHost_r logic. Since, we can use the same code paths
as for a "real" TMAY call.

Change-Id: I6df74e625e90499bd64c9eb34f20db440f6605a6
Reviewed-on: http://gerrit.openafs.org/9711
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
src/viced/host.c
src/viced/host.h