]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
afs: Handle afs_AllocDCache errors
authorAndrew Deason <adeason@sinenomine.net>
Thu, 1 Nov 2012 20:43:09 +0000 (15:43 -0500)
committerStephan Wiesand <stephan.wiesand@desy.de>
Wed, 30 Oct 2013 18:37:41 +0000 (11:37 -0700)
Do not panic if afs_AllocDCache encounters an error and returns NULL.
Instead, go into the normal retry loop that occurs if we couldn't free
up any more free/discard dcache entries.

Reviewed-on: http://gerrit.openafs.org/8405
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit e02185547e316667989a100f77e68b918481b597)

Change-Id: I507a6329b7b4fadaa39d0dc907c15fb5647fc135
Reviewed-on: http://gerrit.openafs.org/10356
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/afs/afs_dcache.c

index 48aa01aa93d59781df5c279293dd2b6d72f767e4..7aa537e6ed0dc97fb3986442c167a5a29f687c54 100644 (file)
@@ -1892,35 +1892,36 @@ afs_GetDCache(struct vcache *avc, afs_size_t abyte,
                goto done;
            }
 
-           /* Make sure there is a free dcache entry for us to use */
            if (afs_discardDCList == NULLIDX && afs_freeDCList == NULLIDX) {
-               while (1) {
-                   if (!setLocks)
-                       avc->f.states |= CDCLock;
-                   /* just need slots */
-                   afs_GetDownD(5, (int *)0, afs_DCGetBucket(avc));
-                   if (!setLocks)
-                       avc->f.states &= ~CDCLock;
-                   if (afs_discardDCList != NULLIDX
-                       || afs_freeDCList != NULLIDX)
-                       break;
-                   /* If we can't get space for 5 mins we give up and panic */
-                   if (++downDCount > 300) {
-                       osi_Panic("getdcache");
-                    }
-                   ReleaseWriteLock(&afs_xdcache);
-                   /*
-                    * Locks held:
-                    * avc->lock(R) if setLocks
-                    * avc->lock(W) if !setLocks
-                    */
-                   afs_osi_Wait(1000, 0, 0);
-                   goto RetryLookup;
-               }
+               if (!setLocks)
+                   avc->f.states |= CDCLock;
+               /* just need slots */
+               afs_GetDownD(5, (int *)0, afs_DCGetBucket(avc));
+               if (!setLocks)
+                   avc->f.states &= ~CDCLock;
            }
-
            tdc = afs_AllocDCache(avc, chunk, aflags, NULL);
-           osi_Assert(tdc);
+           if (!tdc) {
+               /* If we can't get space for 5 mins we give up and panic */
+               if (++downDCount > 300)
+                   osi_Panic("getdcache");
+               ReleaseWriteLock(&afs_xdcache);
+               /*
+                * Locks held:
+                * avc->lock(R) if setLocks
+                * avc->lock(W) if !setLocks
+                */
+               afs_osi_Wait(1000, 0, 0);
+               goto RetryLookup;
+           }
+
+           /*
+            * Locks held:
+            * avc->lock(R) if setLocks
+            * avc->lock(W) if !setLocks
+            * tdc->lock(W)
+            * afs_xdcache(W)
+            */
 
            /*
             * Now add to the two hash chains - note that i is still set