lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:	Fri, 10 Apr 2009 13:55:35 -0700
From:	akpm@...ux-foundation.org
To:	mm-commits@...r.kernel.org
Cc:	jack@...e.cz, hare@...e.de, joern@...fs.org,
	linux-ext4@...r.kernel.org, ronny.pretzsch@....de
Subject: + ext2-do-not-update-mtime-of-a-moved-directory.patch added to -mm tree


The patch titled
     ext2: Do not update mtime of a moved directory
has been added to the -mm tree.  Its filename is
     ext2-do-not-update-mtime-of-a-moved-directory.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: ext2: Do not update mtime of a moved directory
From: Jan Kara <jack@...e.cz>

One of our users is complaining that his backup tool is upset on ext2
(while it's happy on ext3, xfs, ...) because of the mtime change.

The problem is:

mkdir foo
mkdir bar
mkdir foo/a

Now under ext2:
mv foo/a foo/b

changes mtime of 'foo/a' (foo/b after the move).  That does not really
make sence and it does not happen under any other filesystem I've seen.

More complicated is:
mv foo/a bar/a

This changes mtime of foo/a (bar/a after the move) and it makes some sence
since we had to update parent directory pointer of foo/a. But again, no
other filesystem does this. So after some thoughts I'd vote for consistency
and change ext2 to behave the same as other filesystems.



Do not update mtime of a moved directory.  Specs don't say anything
about it (neither that it should, nor that it should not be updated)
and other common filesystems (ext3, ext4, xfs, reiserfs, fat, ...)
don't do it.  So let's become more consistent.

Spotted by ronny.pretzsch@....de, initial fix by Jörn Engel.

Reported-by: <ronny.pretzsch@....de>
Cc: <hare@...e.de>
Cc: Jörn Engel <joern@...fs.org>
Signed-off-by: Jan Kara <jack@...e.cz>
Cc: <linux-ext4@...r.kernel.org>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
---

 fs/ext2/dir.c   |    5 +++--
 fs/ext2/ext2.h  |    2 +-
 fs/ext2/namei.c |    5 +++--
 3 files changed, 7 insertions(+), 5 deletions(-)

diff -puN fs/ext2/dir.c~ext2-do-not-update-mtime-of-a-moved-directory fs/ext2/dir.c
--- a/fs/ext2/dir.c~ext2-do-not-update-mtime-of-a-moved-directory
+++ a/fs/ext2/dir.c
@@ -453,7 +453,7 @@ ino_t ext2_inode_by_name(struct inode *d
 
 /* Releases the page */
 void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,
-			struct page *page, struct inode *inode)
+		   struct page *page, struct inode *inode, int update_times)
 {
 	loff_t pos = page_offset(page) +
 			(char *) de - (char *) page_address(page);
@@ -468,7 +468,8 @@ void ext2_set_link(struct inode *dir, st
 	ext2_set_de_type(de, inode);
 	err = ext2_commit_chunk(page, pos, len);
 	ext2_put_page(page);
-	dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
+	if (update_times)
+		dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
 	EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL;
 	mark_inode_dirty(dir);
 }
diff -puN fs/ext2/ext2.h~ext2-do-not-update-mtime-of-a-moved-directory fs/ext2/ext2.h
--- a/fs/ext2/ext2.h~ext2-do-not-update-mtime-of-a-moved-directory
+++ a/fs/ext2/ext2.h
@@ -111,7 +111,7 @@ extern struct ext2_dir_entry_2 * ext2_fi
 extern int ext2_delete_entry (struct ext2_dir_entry_2 *, struct page *);
 extern int ext2_empty_dir (struct inode *);
 extern struct ext2_dir_entry_2 * ext2_dotdot (struct inode *, struct page **);
-extern void ext2_set_link(struct inode *, struct ext2_dir_entry_2 *, struct page *, struct inode *);
+extern void ext2_set_link(struct inode *, struct ext2_dir_entry_2 *, struct page *, struct inode *, int);
 
 /* fsync.c */
 extern int ext2_sync_file (struct file *, struct dentry *, int);
diff -puN fs/ext2/namei.c~ext2-do-not-update-mtime-of-a-moved-directory fs/ext2/namei.c
--- a/fs/ext2/namei.c~ext2-do-not-update-mtime-of-a-moved-directory
+++ a/fs/ext2/namei.c
@@ -320,7 +320,7 @@ static int ext2_rename (struct inode * o
 		if (!new_de)
 			goto out_dir;
 		inode_inc_link_count(old_inode);
-		ext2_set_link(new_dir, new_de, new_page, old_inode);
+		ext2_set_link(new_dir, new_de, new_page, old_inode, 1);
 		new_inode->i_ctime = CURRENT_TIME_SEC;
 		if (dir_de)
 			drop_nlink(new_inode);
@@ -352,7 +352,8 @@ static int ext2_rename (struct inode * o
 	inode_dec_link_count(old_inode);
 
 	if (dir_de) {
-		ext2_set_link(old_inode, dir_de, dir_page, new_dir);
+		if (old_dir != new_dir)
+			ext2_set_link(old_inode, dir_de, dir_page, new_dir, 0);
 		inode_dec_link_count(old_dir);
 	}
 	return 0;
_

Patches currently in -mm which might be from jack@...e.cz are

origin.patch
linux-next.patch
jbd-update-locking-coments.patch
ext2-add-blk_issue_flush-to-syncing-paths.patch
ext2-do-not-update-mtime-of-a-moved-directory.patch
ext2-fix-data-corruption-for-racing-writes.patch
ext3-fix-chain-verification-in-ext3_get_blocks.patch
quota-remove-obsolete-comments-in-fs-quota-makefile.patch
reiser4-update-names-of-quota-methods.patch

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ