From 42a1981fff5c9b3f4855e4f9200fb6a9de53642b Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Wed, 23 Apr 2003 05:31:14 +0000 Subject: [PATCH] afs-analyze-avoid-potential-loop-20030423 avoid potentially looping forever in e.g. afs_FetchStatus because we exit afs_Analyze too early to increment busyCount, and despite having areq->busyCount non-zero we have servers still not_busy which are already down that we'll never talk to again. that combined with no conn means we never touch most of afs_Analyze, exiting early with shouldRetry set. incrementing busyCount whenever we exit with shouldRetry set should ensure we can never end up looping forever. --- src/afs/afs_analyze.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/afs/afs_analyze.c b/src/afs/afs_analyze.c index 12e0bf85b..14d006855 100644 --- a/src/afs/afs_analyze.c +++ b/src/afs/afs_analyze.c @@ -469,10 +469,10 @@ int afs_Analyze(register struct conn *aconn, afs_int32 acode, for (i=0; i < MAXHOSTS; i++) { if (tvp->status[i] != not_busy && tvp->status[i] != offline) { - tvp->status[i] = not_busy; + tvp->status[i] = not_busy; } - if (tvp->status[i] == not_busy) - shouldRetry = 1; + if (tvp->status[i] == not_busy) + shouldRetry = 1; } afs_PutVolume(tvp, READ_LOCK); } else { @@ -488,6 +488,9 @@ int afs_Analyze(register struct conn *aconn, afs_int32 acode, } else { VSleep(afs_BusyWaitPeriod); /* poll periodically */ } + if (shouldRetry != 0) + areq->busyCount++; + return shouldRetry; /* should retry */ } -- 2.39.5