Mercurial > yaffs-ecoscentric
changeset 146:c293aabe14d0
Fix problem where a chmod with no file write could cause cache loss
| author | charles |
|---|---|
| date | Wed, 06 Sep 2006 00:23:34 +0100 |
| parents | 7c7448871973 |
| children | 5141f90de139 |
| files | yaffs_guts.c |
| diffstat | 1 files changed, 22 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/yaffs_guts.c +++ b/yaffs_guts.c @@ -53,6 +53,7 @@ static void yaffs_HandleUpdateChunk(yaff /* Other local prototypes */ static int yaffs_UnlinkObject( yaffs_Object *obj); +static int yaffs_ObjectHasCachedWriteData(yaffs_Object *obj); static void yaffs_HardlinkFixup(yaffs_Device *dev, yaffs_Object *hardList); @@ -2954,7 +2955,8 @@ int yaffs_UpdateObjectHeader(yaffs_Objec __LINE__); } - in->dirty = 0; + if(!yaffs_ObjectHasCachedWriteData(in)) + in->dirty = 0; /* If this was a shrink, then mark the block that the chunk lives on */ if (isShrink) { @@ -2988,6 +2990,25 @@ int yaffs_UpdateObjectHeader(yaffs_Objec * need a very intelligent search. */ +static int yaffs_ObjectHasCachedWriteData(yaffs_Object *obj) +{ + yaffs_Device *dev = obj->myDev; + int i; + yaffs_ChunkCache *cache; + int nCaches = obj->myDev->nShortOpCaches; + + if(nCaches > 0){ + for(i = 0; i < nCaches; i++){ + if (dev->srCache[i].object == obj && + dev->srCache[i].dirty) + return 1; + } + } + + return 0; +} + + static void yaffs_FlushFilesChunkCache(yaffs_Object * obj) { yaffs_Device *dev = obj->myDev;
