From: Solofo.Ramangalahy@bull.net Subject: Re: [PATCH] ext4: update ctime and mtime for truncate with extents. Date: Thu, 10 Apr 2008 15:11:55 +0200 Message-ID: <18430.4635.195999.326984@frecb006361.adech.frec.bull.fr> References: <18425.57003.125097.61814@frecb006361.adech.frec.bull.fr> <1207802397.3616.4.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: linux-ext4@vger.kernel.org, Szabolcs Szakacsits To: cmm@us.ibm.com Return-path: Received: from ecfrec.frec.bull.fr ([129.183.4.8]:58641 "EHLO ecfrec.frec.bull.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756925AbYDJNLi (ORCPT ); Thu, 10 Apr 2008 09:11:38 -0400 In-Reply-To: <1207802397.3616.4.camel@localhost.localdomain> Sender: linux-ext4-owner@vger.kernel.org List-ID: Mingming Cao writes: > Shouldn't we mark inode dirty after the ctime and and mtime is changed? I should have been more careful when mimicing the non-extent case or examine more closely the patch queue (I am just noticing ext4-update-mtime-and-ctime-on-rename.patch). I honestly do not have a definitive answer now, but I trust you and Jan more than me. ... so, yes, we should. Looking back at the code, there is actually a pattern ext4_current_time() followed by ext4_mark_inode_dirty(), but I do not think it is worth a refactoring. Attached the updated patch. Thanks and sorry for the trouble, -- solofo ext4: update ctime and mtime for truncate with extents. From: Solofo Ramangalahy The recently announced "Linux POSIX file system test suite" http://ntfs3g.org/sw/qa/pjd-fstest-20080402.tgz catched a truncate issue when using extents: mtime and ctime are not updated despite truncate being successful. This is the single issue catched with "default" ext4 (mkfs and mount with minimal options). The testsuite does not report failure with -o noextents. With the following patch, all tests of the testsuite passes: Signed-off-by: Solofo Ramangalahy --- fs/ext4/extents.c | 2 ++ 1 file changed, 2 insertions(+) Index: linux-2.6.25-rc8-git5-ext4-52c7a8013ad2c452551a68ff4daab4bacbe28f9d/fs/ext4/extents.c =================================================================== --- linux-2.6.25-rc8-git5-ext4-52c7a8013ad2c452551a68ff4daab4bacbe28f9d.orig/fs/ext4/extents.c +++ linux-2.6.25-rc8-git5-ext4-52c7a8013ad2c452551a68ff4daab4bacbe28f9d/fs/ext4/extents.c @@ -2947,6 +2947,8 @@ out_stop: ext4_orphan_del(handle, inode); up_write(&EXT4_I(inode)->i_data_sem); + inode->i_mtime = inode->i_ctime = ext4_current_time(inode); + ext4_mark_inode_dirty(handle, inode); ext4_journal_stop(handle); }