macos fsevents hinting
[openafs.git] / src / afs / afs_analyze.c
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 /*
11  * Implements:
12  */
13 #include <afsconfig.h>
14 #include "afs/param.h"
15
16
17 #include "afs/stds.h"
18 #include "afs/sysincludes.h"    /* Standard vendor system headers */
19
20 #ifndef UKERNEL
21 #if !defined(AFS_LINUX20_ENV) && !defined(AFS_FBSD_ENV)
22 #include <net/if.h>
23 #include <netinet/in.h>
24 #endif
25
26 #ifdef AFS_SGI62_ENV
27 #include "h/hashing.h"
28 #endif
29 #if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_FBSD_ENV) && !defined(AFS_DARWIN_ENV)
30 #include <netinet/in_var.h>
31 #endif
32 #endif /* !UKERNEL */
33
34 #include "afsincludes.h"        /* Afs-based standard headers */
35 #include "afs/afs_stats.h"      /* afs statistics */
36 #include "afs/afs_util.h"
37 #include "afs/unified_afs.h"
38
39 #if     defined(AFS_SUN56_ENV)
40 #include <inet/led.h>
41 #include <inet/common.h>
42 #if     defined(AFS_SUN58_ENV)
43 #include <netinet/ip6.h>
44 #endif
45 #include <inet/ip.h>
46 #endif
47
48
49 /* shouldn't do it this way, but for now will do */
50 #ifndef ERROR_TABLE_BASE_U
51 #define ERROR_TABLE_BASE_U      (5376L)
52 #endif /* ubik error base define */
53
54 /* shouldn't do it this way, but for now will do */
55 #ifndef ERROR_TABLE_BASE_uae
56 #define ERROR_TABLE_BASE_uae    (49733376L)
57 #endif /* unified afs error base define */
58
59 /* same hack for vlserver error base as for ubik error base */
60 #ifndef ERROR_TABLE_BASE_VL
61 #define ERROR_TABLE_BASE_VL     (363520L)
62 #define VL_NOENT                (363524L)
63 #endif /* vlserver error base define */
64
65
66 int afs_BusyWaitPeriod = 15;    /* poll every 15 seconds */
67
68 afs_int32 hm_retry_RO = 0;      /* don't wait */
69 afs_int32 hm_retry_RW = 0;      /* don't wait */
70 afs_int32 hm_retry_int = 0;     /* don't wait */
71
72 #define VSleep(at)      afs_osi_Wait((at)*1000, 0, 0)
73
74
75 int lastcode;
76 /* returns:
77  * 0   if the vldb record for a specific volume is different from what
78  *     we have cached -- perhaps the volume has moved.
79  * 1   if the vldb record is the same
80  * 2   if we can't tell if it's the same or not. 
81  *
82  * If 0, the caller will probably start over at the beginning of our
83  * list of servers for this volume and try to find one that is up.  If
84  * not 0, we will probably just keep plugging with what we have
85  * cached.   If we fail to contact the VL server, we  should just keep
86  * trying with the information we have, rather than failing. */
87 #define DIFFERENT 0
88 #define SAME 1
89 #define DUNNO 2
90 static int
91 VLDB_Same(struct VenusFid *afid, struct vrequest *areq)
92 {
93     struct vrequest treq;
94     struct afs_conn *tconn;
95     int i, type = 0;
96     union {
97         struct vldbentry tve;
98         struct nvldbentry ntve;
99         struct uvldbentry utve;
100     } *v;
101     struct volume *tvp;
102     struct cell *tcell;
103     char *bp, tbuf[CVBS];       /* biggest volume id is 2^32, ~ 4*10^9 */
104     unsigned int changed;
105     struct server *(oldhosts[NMAXNSERVERS]);
106
107     AFS_STATCNT(CheckVLDB);
108     afs_FinalizeReq(areq);
109
110     if ((i = afs_InitReq(&treq, afs_osi_credp)))
111         return DUNNO;
112     v = afs_osi_Alloc(sizeof(*v));
113     tcell = afs_GetCell(afid->Cell, READ_LOCK);
114     bp = afs_cv2string(&tbuf[CVBS], afid->Fid.Volume);
115     do {
116         VSleep(2);              /* Better safe than sorry. */
117         tconn =
118             afs_ConnByMHosts(tcell->cellHosts, tcell->vlport, tcell->cellNum,
119                              &treq, SHARED_LOCK);
120         if (tconn) {
121             if (tconn->srvr->server->flags & SNO_LHOSTS) {
122                 type = 0;
123                 RX_AFS_GUNLOCK();
124                 i = VL_GetEntryByNameO(tconn->id, bp, &v->tve);
125                 RX_AFS_GLOCK();
126             } else if (tconn->srvr->server->flags & SYES_LHOSTS) {
127                 type = 1;
128                 RX_AFS_GUNLOCK();
129                 i = VL_GetEntryByNameN(tconn->id, bp, &v->ntve);
130                 RX_AFS_GLOCK();
131             } else {
132                 type = 2;
133                 RX_AFS_GUNLOCK();
134                 i = VL_GetEntryByNameU(tconn->id, bp, &v->utve);
135                 RX_AFS_GLOCK();
136                 if (!(tconn->srvr->server->flags & SVLSRV_UUID)) {
137                     if (i == RXGEN_OPCODE) {
138                         type = 1;
139                         RX_AFS_GUNLOCK();
140                         i = VL_GetEntryByNameN(tconn->id, bp, &v->ntve);
141                         RX_AFS_GLOCK();
142                         if (i == RXGEN_OPCODE) {
143                             type = 0;
144                             tconn->srvr->server->flags |= SNO_LHOSTS;
145                             RX_AFS_GUNLOCK();
146                             i = VL_GetEntryByNameO(tconn->id, bp, &v->tve);
147                             RX_AFS_GLOCK();
148                         } else if (!i)
149                             tconn->srvr->server->flags |= SYES_LHOSTS;
150                     } else if (!i)
151                         tconn->srvr->server->flags |= SVLSRV_UUID;
152                 }
153                 lastcode = i;
154             }
155         } else
156             i = -1;
157     } while (afs_Analyze(tconn, i, NULL, &treq, -1,     /* no op code for this */
158                          SHARED_LOCK, tcell));
159
160     afs_PutCell(tcell, READ_LOCK);
161     afs_Trace2(afs_iclSetp, CM_TRACE_CHECKVLDB, ICL_TYPE_FID, &afid,
162                ICL_TYPE_INT32, i);
163
164     if (i) {
165         afs_osi_Free(v, sizeof(*v));
166         return DUNNO;
167     }
168     /* have info, copy into serverHost array */
169     changed = 0;
170     tvp = afs_FindVolume(afid, WRITE_LOCK);
171     if (tvp) {
172         ObtainWriteLock(&tvp->lock, 107);
173         for (i = 0; i < NMAXNSERVERS && tvp->serverHost[i]; i++) {
174             oldhosts[i] = tvp->serverHost[i];
175         }
176
177         if (type == 2) {
178             InstallUVolumeEntry(tvp, &v->utve, afid->Cell, tcell, &treq);
179         } else if (type == 1) {
180             InstallNVolumeEntry(tvp, &v->ntve, afid->Cell);
181         } else {
182             InstallVolumeEntry(tvp, &v->tve, afid->Cell);
183         }
184
185         if (i < NMAXNSERVERS && tvp->serverHost[i]) {
186             changed = 1;
187         }
188         for (--i; !changed && i >= 0; i--) {
189             if (tvp->serverHost[i] != oldhosts[i]) {
190                 changed = 1;    /* also happens if prefs change.  big deal. */
191             }
192         }
193
194         ReleaseWriteLock(&tvp->lock);
195         afs_PutVolume(tvp, WRITE_LOCK);
196     } else {                    /* can't find volume */
197         tvp = afs_GetVolume(afid, &treq, WRITE_LOCK);
198         if (tvp) {
199             afs_PutVolume(tvp, WRITE_LOCK);
200             afs_osi_Free(v, sizeof(*v));
201             return DIFFERENT;
202         } else {
203             afs_osi_Free(v, sizeof(*v));
204             return DUNNO;
205         }
206     }
207
208     afs_osi_Free(v, sizeof(*v));
209     return (changed ? DIFFERENT : SAME);
210 }                               /*VLDB_Same */
211
212 /*------------------------------------------------------------------------
213  * afs_BlackListOnce
214  *
215  * Description:
216  *      Mark a server as invalid for further attempts of this request only.
217  *
218  * Arguments:
219  *      areq  : The request record associated with this operation.
220  *      afid  : The FID of the file involved in the action.  This argument
221  *              may be null if none was involved.
222  *      tsp   : pointer to a server struct for the server we wish to 
223  *              blacklist. 
224  *
225  * Returns:
226  *      Non-zero value if further servers are available to try,
227  *      zero otherwise.
228  *
229  * Environment:
230  *      This routine is typically called in situations where we believe
231  *      one server out of a pool may have an error condition.
232  *
233  * Side Effects:
234  *      As advertised.
235  *
236  * NOTE:
237  *      The afs_Conn* routines use the list of invalidated servers to 
238  *      avoid reusing a server marked as invalid for this request.
239  *------------------------------------------------------------------------*/
240 static afs_int32 
241 afs_BlackListOnce(struct vrequest *areq, struct VenusFid *afid, 
242                   struct server *tsp)
243 {
244     struct volume *tvp;
245     afs_int32 i;
246     afs_int32 serversleft = 0;
247
248     if (afid) {
249         tvp = afs_FindVolume(afid, READ_LOCK);
250         if (tvp) {
251             for (i = 0; i < AFS_MAXHOSTS; i++) {
252                 if (tvp->serverHost[i] == tsp) {
253                     areq->skipserver[i] = 1;
254                 }
255                 if (tvp->serverHost[i] &&
256                     (tvp->serverHost[i]->addr->sa_flags & 
257                       SRVR_ISDOWN)) {
258                     areq->skipserver[i] = 1;
259                 }
260             }
261             afs_PutVolume(tvp, READ_LOCK);
262             for (i = 0; i < AFS_MAXHOSTS; i++) {
263                 if (tvp->serverHost[i] && areq->skipserver[i] == 0) {
264                     serversleft = 1;
265                     break;
266                 }
267             }
268             return serversleft;
269         }
270     }
271     return 1;
272 }
273
274
275 /*------------------------------------------------------------------------
276  * EXPORTED afs_Analyze
277  *
278  * Description:
279  *      Analyze the outcome of an RPC operation, taking whatever support
280  *      actions are necessary.
281  *
282  * Arguments:
283  *      aconn : Ptr to the relevant connection on which the call was made.
284  *      acode : The return code experienced by the RPC.
285  *      afid  : The FID of the file involved in the action.  This argument
286  *              may be null if none was involved.
287  *      areq  : The request record associated with this operation.
288  *      op    : which RPC we are analyzing.
289  *      cellp : pointer to a cell struct.  Must provide either fid or cell.
290  *
291  * Returns:
292  *      Non-zero value if the related RPC operation should be retried,
293  *      zero otherwise.
294  *
295  * Environment:
296  *      This routine is typically called in a do-while loop, causing the
297  *      embedded RPC operation to be called repeatedly if appropriate
298  *      until whatever error condition (if any) is intolerable.
299  *
300  * Side Effects:
301  *      As advertised.
302  *
303  * NOTE:
304  *      The retry return value is used by afs_StoreAllSegments to determine
305  *      if this is a temporary or permanent error.
306  *------------------------------------------------------------------------*/
307 int
308 afs_Analyze(register struct afs_conn *aconn, afs_int32 acode,
309             struct VenusFid *afid, register struct vrequest *areq, int op,
310             afs_int32 locktype, struct cell *cellp)
311 {
312     afs_int32 i;
313     struct srvAddr *sa;
314     struct server *tsp;
315     struct volume *tvp = NULL;
316     afs_int32 shouldRetry = 0;
317     afs_int32 serversleft = 1;
318     struct afs_stats_RPCErrors *aerrP;
319     afs_int32 markeddown;
320
321  
322  
323     if (AFS_IS_DISCONNECTED && !AFS_IN_SYNC) {
324         /* On reconnection, act as connected. XXX: for now.... */
325         /* SXW - This may get very tired after a while. We should try and
326          *       intercept all RPCs before they get here ... */
327         /*printf("afs_Analyze: disconnected\n");*/
328         afs_FinalizeReq(areq);
329         if (aconn) {
330             /* SXW - I suspect that this will _never_ happen - we shouldn't
331              *       get a connection because we're disconnected !!!*/
332             afs_PutConn(aconn, locktype);
333         }
334         return 0;
335     }
336     
337     AFS_STATCNT(afs_Analyze);
338     afs_Trace4(afs_iclSetp, CM_TRACE_ANALYZE, ICL_TYPE_INT32, op,
339                ICL_TYPE_POINTER, aconn, ICL_TYPE_INT32, acode, ICL_TYPE_LONG,
340                areq->uid);
341
342     aerrP = (struct afs_stats_RPCErrors *)0;
343
344     if ((op >= 0) && (op < AFS_STATS_NUM_FS_RPC_OPS))
345         aerrP = &(afs_stats_cmfullperf.rpc.fsRPCErrors[op]);
346
347     afs_FinalizeReq(areq);
348     if (!aconn && areq->busyCount) {    /* one RPC or more got VBUSY/VRESTARTING */
349
350         tvp = afs_FindVolume(afid, READ_LOCK);
351         if (tvp) {
352             afs_warnuser("afs: Waiting for busy volume %u (%s) in cell %s\n",
353                          (afid ? afid->Fid.Volume : 0),
354                          (tvp->name ? tvp->name : ""),
355                          ((tvp->serverHost[0]
356                            && tvp->serverHost[0]->cell) ? tvp->serverHost[0]->
357                           cell->cellName : ""));
358
359             for (i = 0; i < AFS_MAXHOSTS; i++) {
360                 if (tvp->status[i] != not_busy && tvp->status[i] != offline) {
361                     tvp->status[i] = not_busy;
362                 }
363                 if (tvp->status[i] == not_busy)
364                     shouldRetry = 1;
365             }
366             afs_PutVolume(tvp, READ_LOCK);
367         } else {
368             afs_warnuser("afs: Waiting for busy volume %u\n",
369                          (afid ? afid->Fid.Volume : 0));
370         }
371
372         if (areq->busyCount > 100) {
373             if (aerrP)
374                 (aerrP->err_Volume)++;
375             areq->volumeError = VOLBUSY;
376             shouldRetry = 0;
377         } else {
378             VSleep(afs_BusyWaitPeriod); /* poll periodically */
379         }
380         if (shouldRetry != 0)
381             areq->busyCount++;
382
383         return shouldRetry;     /* should retry */
384     }
385
386     if (!aconn || !aconn->srvr) {
387         if (!areq->volumeError) {
388             if (aerrP)
389                 (aerrP->err_Network)++;
390             if (hm_retry_int && !(areq->flags & O_NONBLOCK) &&  /* "hard" mount */
391                 ((afid && afs_IsPrimaryCellNum(afid->Cell))
392                  || (cellp && afs_IsPrimaryCell(cellp)))) {
393                 if (!afid) {
394                     afs_warnuser
395                         ("afs: hard-mount waiting for a vlserver to return to service\n");
396                     VSleep(hm_retry_int);
397                     afs_CheckServers(1, cellp);
398                     shouldRetry = 1;
399                 } else {
400                     tvp = afs_FindVolume(afid, READ_LOCK);
401                     if (!tvp || (tvp->states & VRO)) {
402                         shouldRetry = hm_retry_RO;
403                     } else {
404                         shouldRetry = hm_retry_RW;
405                     }
406                     if (tvp)
407                         afs_PutVolume(tvp, READ_LOCK);
408                     if (shouldRetry) {
409                         afs_warnuser
410                             ("afs: hard-mount waiting for volume %u\n",
411                              afid->Fid.Volume);
412                         VSleep(hm_retry_int);
413                         afs_CheckServers(1, cellp);
414                     }
415                 }
416             } /* if (hm_retry_int ... */
417             else {
418                 areq->networkError = 1;
419             }
420         }
421         return shouldRetry;
422     }
423
424     /* Find server associated with this connection. */
425     sa = aconn->srvr;
426     tsp = sa->server;
427
428     /* Before we do anything with acode, make sure we translate it back to
429      * a system error */
430     if ((acode & ~0xff) == ERROR_TABLE_BASE_uae)
431         acode = et_to_sys_error(acode);
432
433     if (acode == 0) {
434         /* If we previously took an error, mark this volume not busy */
435         if (areq->volumeError) {
436             tvp = afs_FindVolume(afid, READ_LOCK);
437             if (tvp) {
438                 for (i = 0; i < AFS_MAXHOSTS; i++) {
439                     if (tvp->serverHost[i] == tsp) {
440                         tvp->status[i] = not_busy;
441                     }
442                 }
443                 afs_PutVolume(tvp, READ_LOCK);
444             }
445         }
446
447         afs_PutConn(aconn, locktype);
448         return 0;
449     }
450
451     /* If network troubles, mark server as having bogued out again. */
452     /* VRESTARTING is < 0 because of backward compatibility issues 
453      * with 3.4 file servers and older cache managers */
454 #ifdef AFS_64BIT_CLIENT
455     if (acode == -455)
456         acode = 455;
457 #endif /* AFS_64BIT_CLIENT */
458     if ((acode < 0) && (acode != VRESTARTING)) {
459         if (acode == RX_CALL_TIMEOUT) {
460             serversleft = afs_BlackListOnce(areq, afid, tsp);
461             if (afid)
462                 tvp = afs_FindVolume(afid, READ_LOCK);
463             if (!afid || !tvp || (tvp->states & VRO))
464                 areq->idleError++;
465             if ((serversleft == 0) && tvp &&
466                 ((tvp->states & VRO) || (tvp->states & VBackup))) {
467                 shouldRetry = 0;
468             } else {
469                 shouldRetry = 1;
470             }
471             if (tvp)
472                 afs_PutVolume(tvp, READ_LOCK);
473             /* By doing this, we avoid ever marking a server down
474              * in an idle timeout case. That's because the server is 
475              * still responding and may only be letting a single vnode
476              * time out. We otherwise risk having the server continually
477              * be marked down, then up, then down again... 
478              */
479             goto out;
480         } 
481         markeddown = afs_ServerDown(sa);
482         ForceNewConnections(sa); /**multi homed clients lock:afs_xsrvAddr? */
483         if (aerrP)
484             (aerrP->err_Server)++;
485 #if 0
486         /* retry *once* when the server is timed out in case of NAT */
487         if (markeddown && acode == RX_CALL_DEAD) {
488             aconn->forceConnectFS = 1;
489             shouldRetry = 1;
490         }
491 #endif
492     }
493
494     if (acode == VBUSY || acode == VRESTARTING) {
495         if (acode == VBUSY) {
496             areq->busyCount++;
497             if (aerrP)
498                 (aerrP->err_VolumeBusies)++;
499         } else
500             areq->busyCount = 1;
501
502         tvp = afs_FindVolume(afid, READ_LOCK);
503         if (tvp) {
504             for (i = 0; i < AFS_MAXHOSTS; i++) {
505                 if (tvp->serverHost[i] == tsp) {
506                     tvp->status[i] = rdwr_busy; /* can't tell which yet */
507                     /* to tell which, have to look at the op code. */
508                 }
509             }
510             afs_PutVolume(tvp, READ_LOCK);
511         } else {
512             afs_warnuser("afs: Waiting for busy volume %u in cell %s\n",
513                          (afid ? afid->Fid.Volume : 0), tsp->cell->cellName);
514             VSleep(afs_BusyWaitPeriod); /* poll periodically */
515         }
516         shouldRetry = 1;
517         acode = 0;
518     } else if (acode == VICETOKENDEAD
519                || (acode & ~0xff) == ERROR_TABLE_BASE_RXK) {
520         /* any rxkad error is treated as token expiration */
521         struct unixuser *tu;
522         /*
523          * I'm calling these errors protection errors, since they involve
524          * faulty authentication.
525          */
526         if (aerrP)
527             (aerrP->err_Protection)++;
528
529         tu = afs_FindUser(areq->uid, tsp->cell->cellNum, READ_LOCK);
530         if (tu) {
531             if (acode == VICETOKENDEAD) {
532                 aconn->forceConnectFS = 1;
533             } else if (acode == RXKADEXPIRED) {
534                 aconn->forceConnectFS = 0;      /* don't check until new tokens set */
535                 aconn->user->states |= UTokensBad;
536                 afs_NotifyUser(tu, UTokensDropped);
537                 afs_warnuser
538                     ("afs: Tokens for user of AFS id %d for cell %s have expired\n",
539                      tu->vid, aconn->srvr->server->cell->cellName);
540             } else {
541                 serversleft = afs_BlackListOnce(areq, afid, tsp);
542                 areq->tokenError++;
543
544                 if (serversleft) {
545                     afs_warnuser
546                         ("afs: Tokens for user of AFS id %d for cell %s: rxkad error=%d\n",
547                          tu->vid, aconn->srvr->server->cell->cellName, acode);
548                     shouldRetry = 1;
549                 } else {
550                     areq->tokenError = 0;
551                     aconn->forceConnectFS = 0;  /* don't check until new tokens set */
552                     aconn->user->states |= UTokensBad;
553                     afs_NotifyUser(tu, UTokensDropped);
554                     afs_warnuser
555                         ("afs: Tokens for user of AFS id %d for cell %s are discarded (rxkad error=%d)\n",
556                          tu->vid, aconn->srvr->server->cell->cellName, acode);
557                 }
558             }
559             afs_PutUser(tu, READ_LOCK);
560         } else {
561             /* The else case shouldn't be possible and should probably be replaced by a panic? */
562             if (acode == VICETOKENDEAD) {
563                 aconn->forceConnectFS = 1;
564             } else if (acode == RXKADEXPIRED) {
565                 aconn->forceConnectFS = 0;      /* don't check until new tokens set */
566                 aconn->user->states |= UTokensBad;
567                 afs_NotifyUser(tu, UTokensDropped);
568                 afs_warnuser
569                     ("afs: Tokens for user %d for cell %s have expired\n",
570                      areq->uid, aconn->srvr->server->cell->cellName);
571             } else {
572                 aconn->forceConnectFS = 0;      /* don't check until new tokens set */
573                 aconn->user->states |= UTokensBad;
574                 afs_NotifyUser(tu, UTokensDropped);
575                 afs_warnuser
576                     ("afs: Tokens for user %d for cell %s are discarded (rxkad error = %d)\n",
577                      areq->uid, aconn->srvr->server->cell->cellName, acode);
578             }
579         }
580         shouldRetry = 1;        /* Try again (as root). */
581     }
582     /* Check for access violation. */
583     else if (acode == EACCES) {
584         /* should mark access error in non-existent per-user global structure */
585         if (aerrP)
586             (aerrP->err_Protection)++;
587         areq->accessError = 1;
588         if (op == AFS_STATS_FS_RPCIDX_STOREDATA)
589             areq->permWriteError = 1;
590         shouldRetry = 0;
591     }
592     /* check for ubik errors; treat them like crashed servers */
593     else if (acode >= ERROR_TABLE_BASE_U && acode < ERROR_TABLE_BASE_U + 255) {
594         afs_ServerDown(sa);
595         if (aerrP)
596             (aerrP->err_Server)++;
597         shouldRetry = 1;        /* retryable (maybe one is working) */
598         VSleep(1);              /* just in case */
599     }
600     /* Check for bad volume data base / missing volume. */
601     else if (acode == VSALVAGE || acode == VOFFLINE || acode == VNOVOL
602              || acode == VNOSERVICE || acode == VMOVED) {
603         struct cell *tcell;
604         int same;
605
606         shouldRetry = 1;
607         areq->volumeError = VOLMISSING;
608         if (aerrP)
609             (aerrP->err_Volume)++;
610         if (afid && (tcell = afs_GetCell(afid->Cell, 0))) {
611             same = VLDB_Same(afid, areq);
612             tvp = afs_FindVolume(afid, READ_LOCK);
613             if (tvp) {
614                 for (i = 0; i < AFS_MAXHOSTS && tvp->serverHost[i]; i++) {
615                     if (tvp->serverHost[i] == tsp) {
616                         if (tvp->status[i] == end_not_busy)
617                             tvp->status[i] = offline;
618                         else
619                             tvp->status[i]++;
620                     } else if (!same) {
621                         tvp->status[i] = not_busy;      /* reset the others */
622                     }
623                 }
624                 afs_PutVolume(tvp, READ_LOCK);
625             }
626         }
627     } else if (acode >= ERROR_TABLE_BASE_VL && acode <= ERROR_TABLE_BASE_VL + 255) {    /* vlserver errors */
628         shouldRetry = 0;
629         areq->volumeError = VOLMISSING;
630     } else if (acode >= 0) {
631         if (aerrP)
632             (aerrP->err_Other)++;
633         if (op == AFS_STATS_FS_RPCIDX_STOREDATA)
634             areq->permWriteError = 1;
635         shouldRetry = 0;        /* Other random Vice error. */
636     } else if (acode == RX_MSGSIZE) {   /* same meaning as EMSGSIZE... */
637         VSleep(1);              /* Just a hack for desperate times. */
638         if (aerrP)
639             (aerrP->err_Other)++;
640         shouldRetry = 1;        /* packet was too big, please retry call */
641     }
642
643     if (acode < 0 && acode != RX_MSGSIZE && acode != VRESTARTING) {
644         /* If we get here, code < 0 and we have network/Server troubles.
645          * areq->networkError is not set here, since we always
646          * retry in case there is another server.  However, if we find
647          * no connection (aconn == 0) we set the networkError flag.
648          */
649         afs_MarkServerUpOrDown(sa, SRVR_ISDOWN);
650         if (aerrP)
651             (aerrP->err_Server)++;
652         VSleep(1);              /* Just a hack for desperate times. */
653         shouldRetry = 1;
654     }
655 out:
656     /* now unlock the connection and return */
657     afs_PutConn(aconn, locktype);
658     return (shouldRetry);
659 }                               /*afs_Analyze */