From 68de4bbb02eb4b0cc746d48e636e7540bbda43f9 Mon Sep 17 00:00:00 2001 From: Pavel Semerad Date: Mon, 24 Jun 2002 16:03:34 +0000 Subject: [PATCH] dcache-locking-cleanup-20020624 don't oops if getDCache failed --- src/afs/VNOPS/afs_vnop_read.c | 4 ++-- src/afs/VNOPS/afs_vnop_remove.c | 2 +- src/afs/VNOPS/afs_vnop_symlink.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/afs/VNOPS/afs_vnop_read.c b/src/afs/VNOPS/afs_vnop_read.c index 9ce89031cb..4ad9cff34b 100644 --- a/src/afs/VNOPS/afs_vnop_read.c +++ b/src/afs/VNOPS/afs_vnop_read.c @@ -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); } } diff --git a/src/afs/VNOPS/afs_vnop_remove.c b/src/afs/VNOPS/afs_vnop_remove.c index 1528d31f11..831196a8ce 100644 --- a/src/afs/VNOPS/afs_vnop_remove.c +++ b/src/afs/VNOPS/afs_vnop_remove.c @@ -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 diff --git a/src/afs/VNOPS/afs_vnop_symlink.c b/src/afs/VNOPS/afs_vnop_symlink.c index d626f30eed..13ca0eb4df 100644 --- a/src/afs/VNOPS/afs_vnop_symlink.c +++ b/src/afs/VNOPS/afs_vnop_symlink.c @@ -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 {