From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp02.smtpout.orange.fr ([80.12.242.124]:51075 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753673AbcKCIWk (ORCPT ); Thu, 3 Nov 2016 04:22:40 -0400 Message-ID: <581AF3CB.3090001@wanadoo.fr> Date: Thu, 03 Nov 2016 09:22:35 +0100 From: =?UTF-8?Q?Jean-Pierre_Andr=c3=a9?= MIME-Version: 1.0 To: Al Viro , Jose Lopes CC: linux-fsdevel@vger.kernel.org, fuse-devel@lists.sourceforge.net Subject: Re: [fuse-devel] [PATCH] Make file struct available to fchmod FS handlers. References: <20161102225340.11613-1-jabolopes@gmail.com> <20161103005931.GB19539@ZenIV.linux.org.uk> In-Reply-To: <20161103005931.GB19539@ZenIV.linux.org.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Al Viro wrote: > On Wed, Nov 02, 2016 at 11:53:40PM +0100, Jose Lopes wrote: >> Syscall 'ftruncate' makes the 'file' struct available to filesystem >> handlers. This makes it possible, e.g., for filesystems, such as, >> FUSE, to access the file handle associated with the file descriptor >> that was passed to 'ftruncate'. In the specific case of FUSE, this >> also makes it possible for (userspace) FUSE-based filesystems to >> distinguish between calls to 'truncate' and 'ftruncate'. > > Why FUSE is such a precious snowflake that it needs to make that distinction, > unlike all other filesystems? For fuse file system which delegate the permission checks to user space (and have to do so because of cacheing issues), the write permission has to be checked for truncate(), and not checked for ftruncate() : the file may have been opened for writing and then its permissions set to read-only before the ftruncate() is requested. The user space file system can check current permissions, not the ones which were set when the file was opened. Jean-Pierre