From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Piggin Subject: Re: Filesystem setattr/truncate notes and problems Date: Thu, 3 Jun 2010 19:18:48 +1000 Message-ID: <20100603091848.GB6822@laptop> References: <20100601133923.GT9453@laptop> <20100601134801.GA11061@lst.de> <20100601135655.GU9453@laptop> <20100602195538.GG6152@laptop> <20100602200855.GH6152@laptop> <20100603072812.GA3346@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Al Viro , linux-fsdevel@vger.kernel.org, Miklos Szeredi To: Christoph Hellwig Return-path: Received: from cantor2.suse.de ([195.135.220.15]:33125 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932737Ab0FCJSv (ORCPT ); Thu, 3 Jun 2010 05:18:51 -0400 Content-Disposition: inline In-Reply-To: <20100603072812.GA3346@lst.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, Jun 03, 2010 at 09:28:12AM +0200, Christoph Hellwig wrote: > On Thu, Jun 03, 2010 at 06:08:55AM +1000, Nick Piggin wrote: > > xfs in the 0 length file shortcut, isn't this missing suid kill case? > > (ftruncate mandatory mtime update seems like it wasn't working right > > there either before this patch). > > The wording from Posix for truncate is: > > "Upon successful completion, if the file size is changed, this function > shall mark for update the st_ctime and st_mtime fields of the file, and > the S_ISUID and S_ISGID bits of the file mode may be cleared." > > and for truncate: > > "Upon successful completion, if fildes refers to a regular file, the > ftruncate() function shall mark for update the st_ctime and st_mtime > fields of the file and the S_ISUID and S_ISGID bits of the file mode > may be cleared." > > Which translates to me that the suid/sgid clearing behaviour is > exactly the same as the c/mtime update and it can be skipped for > truncate only if there is no size change. Except that the wording > is rather nasty as the suid/sgid bits are only accepted into Posix > as an ugly headed stepchild and may not actually be present on > some systems. Well at least we should do suid bit clearing consistently with ctime/mtime updates if we do them at all, that part of the wording seems clear.