afs: Add diagnostic messages in afs_InitCacheFile

The function afs_InitCacheFile can return an error under two
conditions: if the number of calls exceeds the number of cache files
specified during cacheinit, and if there is an error while performing
the lookup for the cache filename. In both cases, there there is
nothing logged to assist in diagnosing the problem.

Add diagnostic warnings for the above two conditions with information
related to the error condition.

Change-Id: I887c8b8ec5840c0f1947b6153710b2dba26ab21c
Reviewed-on: https://gerrit.openafs.org/15570
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
This commit is contained in:
Cheyenne Wills 2022-01-20 08:50:29 -07:00 committed by Andrew Deason
parent 1acc612687
commit 7f188ff32d

View File

@ -3393,8 +3393,11 @@ afs_InitCacheFile(char *afile, ino_t ainode)
AFS_STATCNT(afs_InitCacheFile);
index = afs_stats_cmperf.cacheNumEntries;
if (index >= afs_cacheFiles)
if (index >= afs_cacheFiles) {
afs_warn("afs: afs_InitCacheFile: exceeded configured number of "
"cached files (%d >= %d).\n", index, afs_cacheFiles);
return EINVAL;
}
ObtainWriteLock(&afs_xdcache, 282);
tdc = afs_GetNewDSlot(index);
@ -3413,6 +3416,8 @@ afs_InitCacheFile(char *afile, ino_t ainode)
ReleaseWriteLock(&afs_xdcache);
ReleaseWriteLock(&tdc->lock);
afs_PutDCache(tdc);
afs_warn("afs: afs_InitCacheFile: error (%d) adding %s to cache\n",
code, afile);
return code;
}
} else {