X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=yaffs_fs.c;h=fd5e23f26b557596959313889a3142a263e0b0f6;hp=c2ab8888fe332edfa56b33912f2daa4cbab191a9;hb=751cba724040d777d1768dd5d4997039962d2608;hpb=c1e92ca15954ff578e1baae827d9f76077ac3e63 diff --git a/yaffs_fs.c b/yaffs_fs.c index c2ab888..fd5e23f 100644 --- a/yaffs_fs.c +++ b/yaffs_fs.c @@ -31,7 +31,7 @@ */ const char *yaffs_fs_c_version = - "$Id: yaffs_fs.c,v 1.41 2006-01-27 23:54:21 tpoynor Exp $"; + "$Id: yaffs_fs.c,v 1.43 2006-03-08 07:59:20 charles Exp $"; extern const char *yaffs_guts_c_version; #include @@ -838,6 +838,15 @@ static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir) curoffs = 1; + /* If the directory has changed since the open or last call to + readdir, rewind to after the 2 canned entries. */ + + if (f->f_version != inode->i_version) { + offset = 2; + f->f_pos = offset; + f->f_version = inode->i_version; + } + list_for_each(i, &obj->variant.directoryVariant.children) { curoffs++; if (curoffs >= offset) { @@ -1006,15 +1015,15 @@ static int yaffs_unlink(struct inode *dir, struct dentry *dentry) retVal = yaffs_Unlink(yaffs_InodeToObject(dir), dentry->d_name.name); - yaffs_GrossUnlock(dev); - if (retVal == YAFFS_OK) { dentry->d_inode->i_nlink--; + dir->i_version++; + yaffs_GrossUnlock(dev); mark_inode_dirty(dentry->d_inode); return 0; - } else { - return -ENOTEMPTY; } + yaffs_GrossUnlock(dev); + return -ENOTEMPTY; } /* @@ -1269,6 +1278,9 @@ static void yaffs_put_super(struct super_block *sb) yaffs_Device *dev = yaffs_SuperToDevice(sb); yaffs_GrossLock(dev); + + yaffs_FlushEntireDeviceCache(dev); + if (dev->putSuperFunc) { dev->putSuperFunc(sb); }