From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Piggin Subject: Re: [patch] fix truncate inode time modification breakage Date: Wed, 2 Jun 2010 00:32:03 +1000 Message-ID: <20100601143203.GX9453@laptop> References: <20100601133923.GT9453@laptop> <4C0514BD.9070101@panasas.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Al Viro , Christoph Hellwig , linux-fsdevel@vger.kernel.org To: Boaz Harrosh Return-path: Received: from cantor.suse.de ([195.135.220.2]:57488 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756076Ab0FAOcG (ORCPT ); Tue, 1 Jun 2010 10:32:06 -0400 Content-Disposition: inline In-Reply-To: <4C0514BD.9070101@panasas.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue, Jun 01, 2010 at 05:10:05PM +0300, Boaz Harrosh wrote: > On 06/01/2010 04:39 PM, Nick Piggin wrote: > > It appears that I've broken inode time modifications on tmpfs/ext2. > > While ftruncate always updates these attributes, truncate must not > > unless size is changed. I hadn't actually understood that until > > Christoph told me. > > > > Confusion is increased because other filesystems get this wrong. > > Those without ->setattr or ->truncate get it wrong by default. > > Others appear to have problems too. > > > > I haven't gone through many yet, but is there any reason not to > > just do it in the vfs? > > > > --- > > fs/ext2/inode.c | 1 - > > fs/open.c | 3 +++ > > fs/ramfs/file-nommu.c | 5 ----- > > mm/shmem.c | 5 +++-- > > 4 files changed, 6 insertions(+), 8 deletions(-) > > > > Index: linux-2.6/fs/ext2/inode.c > > =================================================================== > > --- linux-2.6.orig/fs/ext2/inode.c > > +++ linux-2.6/fs/ext2/inode.c > > @@ -1203,7 +1203,6 @@ int ext2_setsize(struct inode *inode, lo > > > > __ext2_truncate_blocks(inode, newsize); > > > > - inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; > > OK I was just investigating this. Please forgive my noviceness here: > > So i_mtime is modifications time. i_ctime is creation time? > > if I do ftrunc() (like dd skip=x) don't I want modification time changed > but creation time unchanged? It's change time and modification time. modification time is for data modification. change time is for data and metadata as far as I know (with various little historic quirks like truncate/ftruncate).