From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [patch 3/5] VFS: pass open file to ->xattr() Date: Fri, 21 Sep 2007 15:34:27 +0100 Message-ID: <20070921143427.GB14577@infradead.org> References: <20070921122343.307289079@szeredi.hu> <20070921123333.247493758@szeredi.hu> <20070921124323.GA8088@infradead.org> <20070921130642.GA9431@infradead.org> <1190385151.6680.35.camel@heimdal.trondhjem.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Miklos Szeredi , hch@infradead.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org To: Trond Myklebust Return-path: Received: from pentafluge.infradead.org ([213.146.154.40]:57118 "EHLO pentafluge.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756252AbXIUOeb (ORCPT ); Fri, 21 Sep 2007 10:34:31 -0400 Content-Disposition: inline In-Reply-To: <1190385151.6680.35.camel@heimdal.trondhjem.org> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Fri, Sep 21, 2007 at 10:32:31AM -0400, Trond Myklebust wrote: > On Fri, 2007-09-21 at 15:16 +0200, Miklos Szeredi wrote: > > > > ftruncate is a special case due to O_TRUNC. > > > > No, it's special, because it does not do permission checking, while > > truncate() does. > > So why not just add file->f_op->ftruncate() and file->f_op->fstat()? > Most filesystems can trivially redirect these to do_truncate() and their > existing getattr() method. Those, like FUSE, that care can use the hook. > In fact, I think that NFSv4 could also benefit from an ftruncate(): > currently we have to hunt around for an open file context for that > particular case. Havin the file for fruncate is fine and I'm planning to do something along those lines. Having it for (f)stat is dumb because the operation is in no way related to the open file descriptor.