From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out2-smtp.messagingengine.com ([66.111.4.26]:53549 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754355AbcKCPWF (ORCPT ); Thu, 3 Nov 2016 11:22:05 -0400 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> Date: Thu, 03 Nov 2016 08:22:01 -0700 In-Reply-To: <20161103005931.GB19539@ZenIV.linux.org.uk> (Al Viro's message of "Thu, 3 Nov 2016 00:59:31 +0000") Message-ID: <871sys7fmu.fsf@thinkpad.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, 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 distinct= ion, > 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. 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