changeset 291:bd8e16ecbc93

Get directory mtime to update correctly
author charles
date Tue, 26 May 2009 02:22:44 +0100
parents 3a9aa9edbf78
children 9e100133041b
files yaffs_fs.c
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/yaffs_fs.c
+++ b/yaffs_fs.c
@@ -163,6 +163,11 @@ static struct inode *yaffs_iget(struct s
 #define yaffs_SuperToDevice(sb)	((yaffs_Device *)sb->u.generic_sbp)
 #endif
 
+
+#define update_dir_time(dir) do {\
+			(dir)->i_ctime = (dir)->i_mtime = CURRENT_TIME; \
+		} while(0)
+		
 static void yaffs_put_super(struct super_block *sb);
 
 static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n,
@@ -1286,6 +1291,7 @@ static int yaffs_mknod(struct inode *dir
 	if (obj) {
 		inode = yaffs_get_inode(dir->i_sb, mode, rdev, obj);
 		d_instantiate(dentry, inode);
+		update_dir_time(dir);
 		T(YAFFS_TRACE_OS,
 			("yaffs_mknod created object %d count = %d\n",
 			obj->objectId, atomic_read(&inode->i_count)));
@@ -1339,6 +1345,7 @@ static int yaffs_unlink(struct inode *di
 		dir->i_version++;
 		yaffs_GrossUnlock(dev);
 		mark_inode_dirty(dentry->d_inode);
+		update_dir_time(dir);
 		return 0;
 	}
 	yaffs_GrossUnlock(dev);
@@ -1379,8 +1386,10 @@ static int yaffs_link(struct dentry *old
 
 	yaffs_GrossUnlock(dev);
 
-	if (link)
+	if (link){
+		update_dir_time(dir);
 		return 0;
+	}
 
 	return -EPERM;
 }
@@ -1406,6 +1415,7 @@ static int yaffs_symlink(struct inode *d
 
 		inode = yaffs_get_inode(dir->i_sb, obj->yst_mode, 0, obj);
 		d_instantiate(dentry, inode);
+		update_dir_time(dir);
 		T(YAFFS_TRACE_OS, ("symlink created OK\n"));
 		return 0;
 	} else {
@@ -1478,7 +1488,10 @@ static int yaffs_rename(struct inode *ol
 			new_dentry->d_inode->i_nlink--;
 			mark_inode_dirty(new_dentry->d_inode);
 		}
-
+		
+		update_dir_time(old_dir);
+		if(old_dir != new_dir)
+			update_dir_time(new_dir);
 		return 0;
 	} else {
 		return -ENOTEMPTY;