Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp864269rwr; Wed, 26 Apr 2023 07:19:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ653/BeIJBaI1M097IRTgEm62BMuxUuiPioKTeGG0Lz3jtRJet/OMOJVm8ZpfK0vz0MTqWW X-Received: by 2002:a17:90b:4c51:b0:246:aeee:e61c with SMTP id np17-20020a17090b4c5100b00246aeeee61cmr3265242pjb.11.1682518744862; Wed, 26 Apr 2023 07:19:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682518744; cv=none; d=google.com; s=arc-20160816; b=DKjCAssn1wxuRhraqP5MMk6VhZ0hBXLzc/6Yi0wjSlBDrbGfWswvliU7H/y/C8VXUg zE2PwjZ8Zh0y+RDDjOAp09ubHGp9KBm4l7tq68kgPXu/AfQySG9JI/N+nuKgdqRkOxcp iAgA08Oxslg5YXcVGcA2iBiL+KDXff9B3HAsxBG+cbQHhIpP151xqd6ROr6ow63pr9bv tqn8B7wyqk/z4qFWAPpb+n0IDKZOM8JPxE5xmJZn/1Ng6BY+mgTLK1gY46ul0JkA9qaA HNiEuH9/5SMUDXiquF65ZWxUDF0KFAULf81E1K2caihiOv1+utR877eo+tsjYdYSSCIR 15+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zMWdrgx3QPxggoNy0dsFGPjx8nxLZMYWfHhj4XmU82k=; b=Elj8Bn+Tb7lh5dDGL617GLk/b7L0rUiL8MG5M1v3ELozg1pWwGE5CNfMVz/WeahErT hNKqZ7GZITdalLXyvy9xZb8fWWPzMi9/86A9HZbrmjweUYfdDKB+Z5TBIfoX9jGsQwJC 3svQTYbyfoEk8GwYu+5sy6wzjgExlBch/oxp5Y9NVCFf6ibTKNE5vlBeKXugwuimAdj0 olP6+KK4Vqi1BJHp/SBbd9LghkwbLqlF9iZVYjki1QYBmszU/7Agz8HjoK4YPKlhC8mk F/1snfuNhJ0Re1QFv6BLnQi0IQLrSYnsZrdhZ3Y+twupLi9ro7k5aAxyB4fBG2NyK5sj j/Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tijeAtwS; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nv7-20020a17090b1b4700b00230a8355ff1si20355191pjb.181.2023.04.26.07.18.45; Wed, 26 Apr 2023 07:19:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tijeAtwS; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240010AbjDZOQe (ORCPT + 99 others); Wed, 26 Apr 2023 10:16:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239964AbjDZOQc (ORCPT ); Wed, 26 Apr 2023 10:16:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2729065BE; Wed, 26 Apr 2023 07:16:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BAAD1636F8; Wed, 26 Apr 2023 14:16:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 631DAC433D2; Wed, 26 Apr 2023 14:16:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682518590; bh=VRjUEWt/kW/Xa+uINaPWCBCrQ1cIT2Ul20MybP9eZL8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tijeAtwSYtJ+7NhK0HPJILPdYUw+VVnHRrKNExWS4sGwgI41F46WtN6Ux2G177yfs Lle85Y0P8xMGxb4QmlMB0gJPdEoNbMH5yTapdJCHf8f1iyzCQVHTNzDos5KXMmA/cl bljusGMhoPwwoatWIcbO0rmkaRK+hBC27q7oVr4NWaqaYJvVo6xoPfl8XGhAmBphTF nu/tgQsXuoZt39bOH7B+6BB+jezc9tWBUIrf/3DHclJRtZ+qGkNcJPMT5cLJzUr47g ASAWJo4yxKgJY/jMFsO3KwrrNQrUYjmhumsGz7UhGNzculIFa8DHBZZXRx0h8VMsTq tYQKJB5IjePMg== Date: Wed, 26 Apr 2023 10:16:27 -0400 From: Chuck Lever To: Amir Goldstein Cc: Jan Kara , Christian Brauner , Miklos Szeredi , linux-unionfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-nfs@vger.kernel.org, jlayton@kernel.org Subject: Re: [RFC][PATCH 1/4] exportfs: change connectable argument to bit flags Message-ID: References: <20230425130105.2606684-1-amir73il@gmail.com> <20230425130105.2606684-2-amir73il@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230425130105.2606684-2-amir73il@gmail.com> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Tue, Apr 25, 2023 at 04:01:02PM +0300, Amir Goldstein wrote: > Convert the bool connectable arguemnt into a bit flags argument and > define the EXPORT_FS_CONNECTABLE flag as a requested property of the > file handle. > > We are going to add a flag for requesting non-decodeable file handles. > > Signed-off-by: Amir Goldstein > --- > fs/exportfs/expfs.c | 11 +++++++++-- > fs/nfsd/nfsfh.c | 5 +++-- > include/linux/exportfs.h | 6 ++++-- > 3 files changed, 16 insertions(+), 6 deletions(-) > > diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c > index ab88d33d106c..bf1b4925fedd 100644 > --- a/fs/exportfs/expfs.c > +++ b/fs/exportfs/expfs.c > @@ -393,14 +393,21 @@ int exportfs_encode_inode_fh(struct inode *inode, struct fid *fid, > } > EXPORT_SYMBOL_GPL(exportfs_encode_inode_fh); > > +/** > + * exportfs_encode_fh - encode a file handle from dentry > + * @dentry: the object to encode > + * @fid: where to store the file handle fragment > + * @max_len: maximum length to store there > + * @flags: properties of the requrested file handle Thanks for adding the KDOC comment! /requrested/requested And please add: * * Returns an enum fid_type or a negative errno > + */ > int exportfs_encode_fh(struct dentry *dentry, struct fid *fid, int *max_len, > - int connectable) > + int flags) > { > int error; > struct dentry *p = NULL; > struct inode *inode = dentry->d_inode, *parent = NULL; > > - if (connectable && !S_ISDIR(inode->i_mode)) { > + if ((flags & EXPORT_FH_CONNECTABLE) && !S_ISDIR(inode->i_mode)) { > p = dget_parent(dentry); > /* > * note that while p might've ceased to be our parent already, > diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c > index ccd8485fee04..31e4505c0df3 100644 > --- a/fs/nfsd/nfsfh.c > +++ b/fs/nfsd/nfsfh.c > @@ -414,10 +414,11 @@ static void _fh_update(struct svc_fh *fhp, struct svc_export *exp, > struct fid *fid = (struct fid *) > (fhp->fh_handle.fh_fsid + fhp->fh_handle.fh_size/4 - 1); > int maxsize = (fhp->fh_maxsize - fhp->fh_handle.fh_size)/4; > - int subtreecheck = !(exp->ex_flags & NFSEXP_NOSUBTREECHECK); > + int fh_flags = (exp->ex_flags & NFSEXP_NOSUBTREECHECK) ? 0 : > + EXPORT_FH_CONNECTABLE; > > fhp->fh_handle.fh_fileid_type = > - exportfs_encode_fh(dentry, fid, &maxsize, subtreecheck); > + exportfs_encode_fh(dentry, fid, &maxsize, fh_flags); > fhp->fh_handle.fh_size += maxsize * 4; > } else { > fhp->fh_handle.fh_fileid_type = FILEID_ROOT; > diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h > index 601700fedc91..2b1048238170 100644 > --- a/include/linux/exportfs.h > +++ b/include/linux/exportfs.h > @@ -135,6 +135,8 @@ struct fid { > }; > }; > > +#define EXPORT_FH_CONNECTABLE 0x1 > + > /** > * struct export_operations - for nfsd to communicate with file systems > * @encode_fh: encode a file handle fragment from a dentry > @@ -150,7 +152,7 @@ struct fid { > * encode_fh: > * @encode_fh should store in the file handle fragment @fh (using at most > * @max_len bytes) information that can be used by @decode_fh to recover the > - * file referred to by the &struct dentry @de. If the @connectable flag is > + * file referred to by the &struct dentry @de. If @flag has CONNECTABLE bit > * set, the encode_fh() should store sufficient information so that a good > * attempt can be made to find not only the file but also it's place in the > * filesystem. This typically means storing a reference to de->d_parent in > @@ -226,7 +228,7 @@ struct export_operations { > extern int exportfs_encode_inode_fh(struct inode *inode, struct fid *fid, > int *max_len, struct inode *parent); > extern int exportfs_encode_fh(struct dentry *dentry, struct fid *fid, > - int *max_len, int connectable); > + int *max_len, int flags); > extern struct dentry *exportfs_decode_fh_raw(struct vfsmount *mnt, > struct fid *fid, int fh_len, > int fileid_type, > -- > 2.34.1 >