OpenAFS Master Repository branch, master, updated. BP-openafs-stable-1_8_x-158-g0322dd5
Gerrit Code Review
gerrit@openafs.org
Thu, 28 Jun 2018 22:22:36 -0400
The following commit has been merged in the master branch:
commit 0322dd56b20b2e2fd6eb7f217964174fb5d25cdd
Author: Andrew Deason <adeason@sinenomine.net>
Date: Thu Jun 28 13:08:47 2018 -0500
afs: Change afs_AllocDCache to return error codes
Currently, afs_AllocDCache can fail in 2 different situations:
- When we are out of dslots on the free/discard lists
- When we encounter an i/o error when trying to traverse the dslot
lists
But afs_AllocDCache cannot distinguish between these two cases to its
caller in any way, since all we have to return is a struct dcache (and
so we return NULL on any error).
Currently, the caller of afs_AllocDCache in afs_GetDCache is
determining which of these cases happened by looking at
afs_discardDCList and afs_freeDCList, to see if they look empty. This
is not great for at least a couple of reasons:
- We are examining afs_discardDCList/afs_freeDCList after we drop
afs_xdcache (but while still holding GLOCK)
- If afs_discardDCList/afs_freeDCList are somehow changed while
afs_AllocDCache is running, we may infer the wrong reason why
afs_AllocDCache failed. (currently impossible, but this seems
fragile)
And in general, this check against afs_discardDCList/afs_freeDCList is
rather indirect. It may be easier to follow if afs_AllocDCache just
directly returned the reason why it failed.
So do that, by changing afs_AllocDCache to return an error code, and
providing the struct dcache in an output argument. This involves
similiarly changing several called functions in the same way, to
return error codes. We only define 2 such error codes with this
commit:
- ENOSPC, when we are out of free/discrad dslots
- EIO, when we encounter a disk i/o error when trying to examine the
dslot list
Note that this commit should not change any real logic; we're mostly
just changing how errors are returned from these various functions.
Change-Id: I07cc3d7befdcc98360889f4a2ba01fdc9de50848
Reviewed-on: https://gerrit.openafs.org/13227
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/afs/afs_dcache.c | 109 ++++++++++++++++++++++++++++++--------------------
1 files changed, 65 insertions(+), 44 deletions(-)
--
OpenAFS Master Repository