From 4b2be9588b87feecd0124cec9014b4a9b3c6933a Mon Sep 17 00:00:00 2001 From: Chas Williams Date: Tue, 30 Jul 2002 20:34:32 +0000 Subject: [PATCH] Enable afs_DoPartialWrite() and afs_PrefetchChunk() in afs_UFSRead and afs_UFSWrite for Linux; fixes deadlock condition for small cache sizes. --- src/afs/VNOPS/afs_vnop_read.c | 6 +++--- src/afs/VNOPS/afs_vnop_write.c | 16 ++++++---------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/afs/VNOPS/afs_vnop_read.c b/src/afs/VNOPS/afs_vnop_read.c index bbbe2f3a2d..55d4160f89 100644 --- a/src/afs/VNOPS/afs_vnop_read.c +++ b/src/afs/VNOPS/afs_vnop_read.c @@ -330,7 +330,7 @@ tagain: */ if (tdc) { ReleaseReadLock(&tdc->lock); -#ifndef AFS_VM_RDWR_ENV +#if !defined(AFS_VM_RDWR_ENV) || defined(AFS_LINUX22_ENV) /* try to queue prefetch, if needed */ if (!noLock) { afs_PrefetchChunk(avc, tdc, acred, &treq); @@ -559,7 +559,7 @@ afs_UFSReadFast(avc, auio, acred, albn, abpp, noLock) if (!noLock) { ReleaseReadLock(&avc->lock); -#ifndef AFS_VM_RDWR_ENV +#if !defined(AFS_VM_RDWR_ENV) || defined(AFS_LINUX22_ENV) if (!(code = afs_InitReq(&treq, acred))) { if (!(tdc->mflags & DFNextStarted)) afs_PrefetchChunk(avc, tdc, acred, &treq); @@ -982,7 +982,7 @@ tagain: */ if (tdc) { ReleaseReadLock(&tdc->lock); -#ifndef AFS_VM_RDWR_ENV +#if !defined(AFS_VM_RDWR_ENV) || defined(AFS_LINUX22_ENV) /* try to queue prefetch, if needed */ if (!noLock) { if (!(tdc->mflags & DFNextStarted)) diff --git a/src/afs/VNOPS/afs_vnop_write.c b/src/afs/VNOPS/afs_vnop_write.c index 53a0d4013d..b19b244af5 100644 --- a/src/afs/VNOPS/afs_vnop_write.c +++ b/src/afs/VNOPS/afs_vnop_write.c @@ -297,7 +297,9 @@ afs_MemWrite(avc, auio, aio, acred, noLock) avc->m.Length = filePos; } #endif -#ifndef AFS_VM_RDWR_ENV + ReleaseWriteLock(&tdc->lock); + afs_PutDCache(tdc); +#if !defined(AFS_VM_RDWR_ENV) || defined(AFS_LINUX22_ENV) /* * If write is implemented via VM, afs_DoPartialWrite() is called from * the high-level write op. @@ -306,14 +308,10 @@ afs_MemWrite(avc, auio, aio, acred, noLock) code = afs_DoPartialWrite(avc, &treq); if (code) { error = code; - ReleaseWriteLock(&tdc->lock); - afs_PutDCache(tdc); break; } } #endif - ReleaseWriteLock(&tdc->lock); - afs_PutDCache(tdc); } #ifndef AFS_VM_RDWR_ENV afs_FakeClose(avc, acred); @@ -618,7 +616,9 @@ afs_UFSWrite(avc, auio, aio, acred, noLock) } #endif osi_UFSClose(tfile); -#ifndef AFS_VM_RDWR_ENV + ReleaseWriteLock(&tdc->lock); + afs_PutDCache(tdc); +#if !defined(AFS_VM_RDWR_ENV) || defined(AFS_LINUX22_ENV) /* * If write is implemented via VM, afs_DoPartialWrite() is called from * the high-level write op. @@ -627,14 +627,10 @@ afs_UFSWrite(avc, auio, aio, acred, noLock) code = afs_DoPartialWrite(avc, &treq); if (code) { error = code; - ReleaseWriteLock(&tdc->lock); - afs_PutDCache(tdc); break; } } #endif - ReleaseWriteLock(&tdc->lock); - afs_PutDCache(tdc); } #ifndef AFS_VM_RDWR_ENV afs_FakeClose(avc, acred);