dcache-locking-cleanup-20020624
authorPavel Semerad <semerad@ss1000.ms.mff.cuni.cz>
Mon, 24 Jun 2002 16:03:34 +0000 (16:03 +0000)
committerDerrick Brashear <shadow@dementia.org>
Mon, 24 Jun 2002 16:03:34 +0000 (16:03 +0000)
don't oops if getDCache failed

src/afs/VNOPS/afs_vnop_read.c
src/afs/VNOPS/afs_vnop_remove.c
src/afs/VNOPS/afs_vnop_symlink.c

index 9ce8903..4ad9cff 100644 (file)
@@ -258,7 +258,7 @@ tagain:
                ReleaseReadLock(&avc->lock);
                tdc = afs_GetDCache(avc, filePos, &treq, &offset, &len, 1);
                ObtainReadLock(&avc->lock);
-               ObtainReadLock(&tdc->lock);
+               if (tdc) ObtainReadLock(&tdc->lock);
            }
        }
 
@@ -801,7 +801,7 @@ tagain:
                ReleaseReadLock(&avc->lock);
                tdc = afs_GetDCache(avc, filePos, &treq, &offset, &len, 1);
                ObtainReadLock(&avc->lock);
-               ObtainReadLock(&tdc->lock);
+               if (tdc) ObtainReadLock(&tdc->lock);
            }
        }
        
index 1528d31..831196a 100644 (file)
@@ -313,7 +313,7 @@ tagain:
 
     tdc        = afs_GetDCache(adp, (afs_size_t) 0,    &treq, &offset, &len, 1);  /* test for error below */
     ObtainWriteLock(&adp->lock,142);
-    ObtainSharedLock(&tdc->lock, 638);
+    if (tdc) ObtainSharedLock(&tdc->lock, 638);
 
     /*
      * Make sure that the data in the cache is current. We may have
index d626f30..13ca0eb 100644 (file)
@@ -125,7 +125,7 @@ afs_symlink
     tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &offset, &len, 1);
     volp = afs_FindVolume(&adp->fid, READ_LOCK); /*parent is also in same vol*/
     ObtainWriteLock(&adp->lock,156);
-    ObtainWriteLock(&tdc->lock, 636);
+    if (tdc) ObtainWriteLock(&tdc->lock, 636);
     ObtainSharedLock(&afs_xvcache,17);  /* prevent others from creating this entry */
     /* XXX Pay attention to afs_xvcache around the whole thing!! XXX */
     do {