From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: + switch-ntfs-to-touch_atime.patch added to -mm tree Date: Tue, 8 Nov 2005 05:43:10 +0100 Message-ID: <20051108044310.GC8531@lst.de> References: <200511060035.jA60Zk1U004874@shell0.pdx.osdl.net> <20051106041321.GC30958@lst.de> <20051105203531.7b67c2d8.akpm@osdl.org> <20051107034614.GB16058@lst.de> <20051107115914.GA24006@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Christoph Hellwig , Andrew Morton , linux-fsdevel@vger.kernel.org Return-path: Received: from verein.lst.de ([213.95.11.210]:38798 "EHLO mail.lst.de") by vger.kernel.org with ESMTP id S964892AbVKHEnP (ORCPT ); Mon, 7 Nov 2005 23:43:15 -0500 To: Anton Altaparmakov Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org [ccing -fsdevel now because this is something of interest to the public] On Mon, Nov 07, 2005 at 09:51:08PM +0000, Anton Altaparmakov wrote: > What callers are those? I am curious... The SUS/Posix standard requires > it as I said in previous post (except for the no size change case but > as I also said in previous post the VFS does that wrong in same way as > ntfs and I just copied vfs)... Besides the various ->setattr instaces which are supposed to set ctime if ATTR_SIZE|ATTR_CTIME are set (which it is for sys_truncate or sys_ftruncate but possibly not nfsd requests) generic_file_buffered_write() calls vmtruncate and thus ->truncate without asking for ctime updates. The point here is to repeat that the nth time is that you are doing things in ->truncate that you shouldn't do there. Just move your updates of the base inode to ->setattr, and update ->i_ctime directly like all the other filesystems do instead of using inode_update_time which contains an optimization that's only usefull for a codepath like write where the ctime/mtime update happens very frequently. Your use of the function is wrong no matter whether it takes a struct file or struct inode. > > so just update them directly for those callers. > > That is difficult to do as VFS ->truncate() does not allow an error to be > returned. And the setting must only happen on success for {f,}truncate(). > > Thus vmtruncate() always returns success even when ->truncate() failed, so > VFS _cannot_ be compliant with standard unless it is changed so that > ->truncate() can return error and vmtruncate() passes that upward to > ->setattr(). Otherwise you have to do the cmtime updates from > ->truncate() on success and not do them on failure. so please submit a patch to allow an error return from ->truncate.