From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out2-smtp.messagingengine.com ([66.111.4.26]:42852 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752096AbcKGEv2 (ORCPT ); Sun, 6 Nov 2016 23:51:28 -0500 From: Nikolaus Rath To: Al Viro Cc: Jose Lopes , linux-fsdevel@vger.kernel.org, fuse-devel@lists.sourceforge.net Subject: Re: [PATCH] Make file struct available to fchmod FS handlers. References: <20161102225340.11613-1-jabolopes@gmail.com> <20161103005931.GB19539@ZenIV.linux.org.uk> <871sys7fmu.fsf@thinkpad.rath.org> Date: Sun, 06 Nov 2016 20:51:26 -0800 In-Reply-To: <871sys7fmu.fsf@thinkpad.rath.org> (Nikolaus Rath's message of "Thu, 03 Nov 2016 08:22:01 -0700") Message-ID: <877f8fyjsh.fsf@vostro.rath.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Nov 03 2016, Nikolaus Rath wrote: > On Nov 03 2016, 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 distinc= tion, >> unlike all other filesystems? > > FUSE filesystems are often used as an extra layer on top of another > filesystem (that stores the actual data). If the user opens a file (in > the fuse filesystem), deletes it, and then truncates it, FUSE currently > cannot do the same operation in the underlying filesystem: it receives > a truncate() call with the inode, but there is no syscall that allows > truncation for an inode. If FUSE had access to the file handle, it can > use that to store a file descriptor for the file on the underlying > filesystem and use ftruncate. In case it wasn't clear: for the case of ftruncate, fuse *does* have access to the file handle so the problem does not arise. For the case of fchmod, this is currently a problem (and the patch we're discussing would fix it). Best, -Nikolaus --=20 GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F =C2=BBTime flies like an arrow, fruit flies like a Banana.=C2= =AB