Re: [nfsv4] xattr model in draft-naik-nfsv4-xattrs-01?

Christoph Hellwig <hch@lst.de> Tue, 07 October 2014 09:37 UTC

Return-Path: <hch@lst.de>
X-Original-To: nfsv4@ietfa.amsl.com
Delivered-To: nfsv4@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id DDF3F1A02BD for <nfsv4@ietfa.amsl.com>; Tue, 7 Oct 2014 02:37:28 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.336
X-Spam-Level:
X-Spam-Status: No, score=-2.336 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HELO_EQ_DE=0.35, RP_MATCHES_RCVD=-0.786] autolearn=ham
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tLV7qF90OP68 for <nfsv4@ietfa.amsl.com>; Tue, 7 Oct 2014 02:37:26 -0700 (PDT)
Received: from newverein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 4ED651ACCFC for <nfsv4@ietf.org>; Tue, 7 Oct 2014 02:37:25 -0700 (PDT)
Received: by newverein.lst.de (Postfix, from userid 2407) id F100B144FE; Tue, 7 Oct 2014 11:37:23 +0200 (CEST)
Date: Tue, 07 Oct 2014 11:37:23 +0200
From: Christoph Hellwig <hch@lst.de>
To: Manoj Naik <mnaik@us.ibm.com>
Message-ID: <20141007093723.GA13519@lst.de>
References: <20141004161750.GA22828@lst.de> <OF88F663C8.C237679D-ON88257D67.006E4B58-88257D67.0070FBCC@us.ibm.com> <20141005072228.GA6312@lst.de> <OFE40CB917.BC1F18C3-ON88257D69.0071923E-88257D69.007356B2@us.ibm.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <OFE40CB917.BC1F18C3-ON88257D69.0071923E-88257D69.007356B2@us.ibm.com>
User-Agent: Mutt/1.5.17 (2007-11-01)
Archived-At: http://mailarchive.ietf.org/arch/msg/nfsv4/bTiqphwrlgJnh4-PpFHfHTpcr1g
Cc: Christoph Hellwig <hch@lst.de>, nfsv4@ietf.org
Subject: Re: [nfsv4] xattr model in draft-naik-nfsv4-xattrs-01?
X-BeenThere: nfsv4@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: NFSv4 Working Group <nfsv4.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/nfsv4>, <mailto:nfsv4-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/nfsv4/>
List-Post: <mailto:nfsv4@ietf.org>
List-Help: <mailto:nfsv4-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/nfsv4>, <mailto:nfsv4-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 07 Oct 2014 09:37:29 -0000

On Mon, Oct 06, 2014 at 01:59:49PM -0700, Manoj Naik wrote:
> > Why would you want to limit the number of operations?  Adding a new
> > compound operation just is a new entry in a new dispatch table, which
> > adding tons of unions complicates parsing at runtime, bloats data
> > structures and makes the standard unreadable, thus placing a burden on
> > human and machine.
> 
> I think you're referring to this:
> 
>         union getxattr_res4 switch (getxattr_type4 gr_type) {
>          case GETXATTR4_LIST:
>                 xattrname4    gr_names<>;
>          case GETXATTR4_ONE:
>                 xattrvalue4   gr_value;
>          case GETXATTR4_ALL:
>                 xattr4        gr_xattrs<>;
>         };
> 
> This isn't any more bloated/unreadable than a lot of existing protocol
> definitions and operations. I am not arguing against LISTXATTR/REMOVEXATTR
> being separate operations, but there is precedence in the existing spec for
> operations that are far more complicated that this :)

It's pretty awkward together with how the args structure is defined.
The actual GET operation has indeed zero overlap with a LIST one,
as the GET operates on a name, while LIST just operates on the implicit
FH.

> > Setting multiple attributes can easily be archives by multiple SETXATTR
> > operations in a compound.  Getting multiple attributes in one operation
> > might sound useful, but there is a reason why it hasn't be implemented
> > so far, and the main reason is that it's not sanely implementable at
> > the OS lewvel.  More on that below.
> 
> An operation that replaces ALL the xattr keys of a file with another set of
> keys could be done in a compound if we added a separate REMOVEXATTR that
> allowed deleting all the xattrs of a file. Otherwise this would need a
> LISTXATTR, delete individual xattrs and SETXATTR each one, and this cannot
> be achieved in a single COMPOUND.

What is the use case for a REPLACE_ALL again?  In the OS xattr model,
attributes are separate, so there never is need for a REPLACE_ALL.  This
gets even more complicated if you want to support additional xattr
namespaces, as you have to take permissions into account, or the
fact that some of the non-user namespaces can't even be replaced.

I stand to my opinion that these operations really do not belong into
the xattr model.  And just to be clear: this is different from the
list+get operation which does fit into the model, although I don't
see it as useful due to the lack of implementations.

> > Both setxattr and listxattr return data that basically is unbound for
> > a simple request.  While this isn't a problem at the XDR level it is a
> > problem at the syscall level.  If you look how the get and list
> operations
> > are specified you'll see that they take special care of this at the API
> > level.
> 
> This is not unbounded for the protocol either. Section 4 states:
> 
>    Similar to ACLs, the amount of xattr data exchanged between the
>    client and server for get/set operations can be considered to fit in
>    a single COMPOUND request, bounded by the channel's negotiated
>    maximum size for requests.
> 
> More on relaxing this requirement (for list/getall/setall) separately.

That's why I said basically unbounded and not unbounded.  The session
limit is still large enough that you don't want your application
to allocate each buffer for a get to fit the session limit.