afs: Avoid GetDCache delays on screwy cache 33/13033/3
authorAndrew Deason <adeason@sinenomine.net>
Thu, 26 Apr 2018 17:01:57 +0000 (12:01 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Sun, 10 Jun 2018 21:15:21 +0000 (17:15 -0400)
commitbec329c1c81d96b5933527f7cdb3638f24833087
treea708009bafe2afcb68082febb44ba563cfed2185
parent0ff2364bd5e68c0a7587f8fbc552bf20b99d7039
afs: Avoid GetDCache delays on screwy cache

Currently, if our afs_AllocDCache call fails in afs_GetDCache, we
retry once per second for 5 minutes. The reasoning is that we're out
of dcache slots, and so if we wait a little while, maybe something
will become freeable and we can continue.

However, afs_AllocDCache can also fail if we have plenty of free
dslots, but we are unable to successfully call afs_GetUnusedDSlot() on
any of them. This can happen if our disk cache is screwed up, and so
waiting and retrying will not make things better (but we'll spew a ton
of "disk cache read error in CacheItems slot" errors in the log each
time, and do so 300 times).

So instead, only do our sleep/retry loop if we actually appear to be
out of free or discarded dslots. Otherwise, just return an error
immediately, since sleeping and retrying will not make anything
better.

Change-Id: I331913ab882216e3f71cc44da91f7f7d33c34004
Reviewed-on: https://gerrit.openafs.org/13033
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
src/afs/afs_dcache.c