[PATCH] ext2: update inode ctime on rename()

Linux Kernel Mailing List <[email protected]> Fri, 12 May 2006 18:59:44 GMT
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
commit 429efe1830dfecd764a81d8c50718100219136ce
tree 1173ec7eb06434d84b28b54aa2b11d21f0012aa5
parent 43c4779f43e06f1b34f0da43610f0b33d7a2709a
author Willy TARREAU <willy@pcw.(none)> Sun, 07 May 2006 21:33:23 +0200
committer Willy TARREAU <willy@pcw.(none)> Sun, 07 May 2006 21:33:23 +0200

[PATCH] ext2: update inode ctime on rename()

The ext2fs filesystem on 2.2 and 2.6, as well as other filesystems
on 2.4 update the inode ctime on rename(). When this fix was applied
to 2.2.13, it was applied to the ext3 tree at the same time, but the
ext2 tree was forgotten. It was recently fixed in 2.6, but 2.4 was
forgotten again. Here's the fix.

First reported by Chris Siebenmann on 10 Jan 2004 !

Signed-off-by: Willy Tarreau <[email protected]>

- Willy

 fs/ext2/namei.c |    7 +++++++
 1 files changed, 7 insertions(+)

diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index 364deca..13c8f59 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -313,6 +313,13 @@ static int ext2_rename (struct inode * o
 			ext2_inc_count(new_dir);
 	}
 
+	/*
+	 * Like most other Unix systems, set the ctime for inodes on a
+	 * rename. Note that other 2.4 FS as well as EXT2 on 2.2 and 2.6
+	 * do this. ext2_dec_count() will mark the inode dirty.
+	 */
+	old_inode->i_ctime = CURRENT_TIME;
+
 	ext2_delete_entry (old_de, old_page);
 	ext2_dec_count(old_inode);