On Tue, Jun 01, 2010 at 03:48:01PM +0200, Christoph Hellwig wrote: > On Tue, Jun 01, 2010 at 11:39:23PM +1000, 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? > > Doing it in the VFS is fine with me, we still have the the file > pointer in struct iatta to indicate a ftruncate / open O_TRUNC > if any filesystem really cares. But I think you need to audit > all instances if they care about this. And while you're at it > also remove the code handling this and the comments about it in > XFS. Yes I was starting to look at that. Just want to see if I'm on the right track. > > - if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE)) { > > - loff_t newsize = attr->ia_size; > > + if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE) && > > + newsize != inode->i_size) { > > Btw, the S_ISREG is superflous - we only ever set ATTR_SIZE for > regular files from the upper layer code. OK I'll get rid of it in the same patch. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html