From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: Filesystem setattr/truncate notes and problems Date: Thu, 3 Jun 2010 09:28:12 +0200 Message-ID: <20100603072812.GA3346@lst.de> References: <20100601133923.GT9453@laptop> <20100601134801.GA11061@lst.de> <20100601135655.GU9453@laptop> <20100602195538.GG6152@laptop> <20100602200855.GH6152@laptop> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Christoph Hellwig , Al Viro , linux-fsdevel@vger.kernel.org, Miklos Szeredi To: Nick Piggin Return-path: Received: from verein.lst.de ([213.95.11.210]:43667 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752675Ab0FCH23 (ORCPT ); Thu, 3 Jun 2010 03:28:29 -0400 Content-Disposition: inline In-Reply-To: <20100602200855.GH6152@laptop> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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. Which means XFS behaviour for truncate while not strictly against Posix is at least unexpected. I'll fix it up.