Skip to contentSkip to conversation

hpfs: update ctime/mtime of old/new_dir

PATCH In review Taesoo Kim 2 participants 2 messages Mar 24, 2015 – Aug 11, 2015 Hpfs filesystem

lore
Share & tools
lore

Taesoo Kim

author
#0 lore raw

PATCH 1/1 hpfs: update ctime/mtime of old/new_dir

Upon successful rename(), update ctime and mtime of old/new_dir, as posix specifies.

---
 fs/hpfs/namei.c | 6 ++++++
 1 file changed, 6 insertions(+)
fs/hpfs/namei.c +6 -0
index bdbc2c3..8d8669c 100644
@@ -600,6 +600,12 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	if (S_ISDIR(i->i_mode)) {
 		inc_nlink(new_dir);
 		drop_nlink(old_dir);
+
+		old_dir->i_ctime.tv_sec = old_dir->i_mtime.tv_sec = local_to_gmt(old_dir->i_sb, get_seconds());
+		old_dir->i_ctime.tv_nsec = old_dir->i_mtime.tv_nsec = 0;
+
+		new_dir->i_ctime.tv_sec = new_dir->i_mtime.tv_sec = local_to_gmt(new_dir->i_sb, get_seconds());
+		new_dir->i_ctime.tv_nsec = new_dir->i_mtime.tv_nsec = 0;
 	}
 	if ((fnode = hpfs_map_fnode(i->i_sb, i->i_ino, &bh))) {
 		fnode->up = cpu_to_le32(new_dir->i_ino);
Signature · 1 line
2.3.3
#1 lore raw
Quoted 27 lines · Taesoo Kim

Upon successful rename(), update ctime and mtime of old/new_dir, as posix specifies.

---
 fs/hpfs/namei.c | 6 ++++++
 1 file changed, 6 insertions(+)
fs/hpfs/namei.c +6 -0
index bdbc2c3..8d8669c 100644
@@ -600,6 +600,12 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	if (S_ISDIR(i->i_mode)) {
 		inc_nlink(new_dir);
 		drop_nlink(old_dir);
+
+		old_dir->i_ctime.tv_sec = old_dir->i_mtime.tv_sec = local_to_gmt(old_dir->i_sb, get_seconds());
+		old_dir->i_ctime.tv_nsec = old_dir->i_mtime.tv_nsec = 0;
+
+		new_dir->i_ctime.tv_sec = new_dir->i_mtime.tv_sec = local_to_gmt(new_dir->i_sb, get_seconds());
+		new_dir->i_ctime.tv_nsec = new_dir->i_mtime.tv_nsec = 0;
 	}
 	if ((fnode = hpfs_map_fnode(i->i_sb, i->i_ino, &bh))) {
 		fnode->up = cpu_to_le32(new_dir->i_ino);
Signature · 1 line
2.3.3

Hi

The patch is buggy - it only changes time in memory and never saves it to the disk, it doesn't change time when we rename non-directory entry. It also doesn't change time on other directory modifications - creating or deleting files.

I will send a correct patch at the beginning of the next merge window.

Mikuklas