X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=yaffs_fs.c;h=00bb742cf4aff519208c626eab8a167cf458b33b;hb=b91298ceff82f7f47539ec0308c6b310e1d9e755;hp=099a1083122eb1ff1f1cccc3c9fea0a4c2e84260;hpb=829a3f784f8f2fb79898ecb0ccc55c61b3eaef53;p=yaffs%2F.git diff --git a/yaffs_fs.c b/yaffs_fs.c index 099a108..00bb742 100644 --- a/yaffs_fs.c +++ b/yaffs_fs.c @@ -24,11 +24,12 @@ * * Nick Bane for numerous patches. * * Nick Bane for 2.5/2.6 integration. * * Andras Toth for mknod rdev issue. + * * Michael Fischer for finding the problem with inode inconsistency. * * Some code bodily lifted from JFFS2. */ -const char *yaffs_fs_c_version = "$Id: yaffs_fs.c,v 1.34 2004-09-20 22:00:20 charles Exp $"; +const char *yaffs_fs_c_version = "$Id: yaffs_fs.c,v 1.35 2004-10-20 20:12:43 charles Exp $"; extern const char *yaffs_guts_c_version; @@ -364,15 +365,29 @@ static void yaffs_put_inode(struct inode *inode) // clear is called to tell the fs to release any per-inode data it holds static void yaffs_clear_inode(struct inode *inode) { - yaffs_Object *obj = yaffs_InodeToObject(inode); + yaffs_Object *obj; + yaffs_Device *dev; + + obj = yaffs_InodeToObject(inode); T(YAFFS_TRACE_OS,("yaffs_clear_inode: ino %d, count %d %s\n",(int)inode->i_ino, atomic_read(&inode->i_count), obj ? "object exists" : "null object")); if(obj) { + dev = obj->myDev; + yaffs_GrossLock(dev); + + // Clear the association between the inode ant the yaffs_Object. obj->myInode = NULL; - inode->u.generic_ip = NULL; + inode->u.generic_ip = NULL; + + // If the object freeing was deferred, then the real free happens now. + // This should fix the inode inconsistency problem. + + yaffs_HandleDeferedFree(obj); + + yaffs_GrossUnlock(dev); }