From 7f188ff32dc7c521b9771fde60d77ccfb5792d79 Mon Sep 17 00:00:00 2001 From: Cheyenne Wills Date: Thu, 20 Jan 2022 08:50:29 -0700 Subject: [PATCH] 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 Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Tested-by: BuildBot --- src/afs/afs_dcache.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index c1c6413a69..7171e1da63 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -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 {