public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Christian Brauner <brauner@kernel.org>
Cc: Amir Goldstein <amir73il@gmail.com>,
	Jeff Layton <jlayton@kernel.org>,
	Erin Shepherd <erin.shepherd@e43.eu>,
	Chuck Lever <chuck.lever@oracle.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-nfs@vger.kernel.org, stable <stable@kernel.org>
Subject: Re: [PATCH 1/4] exportfs: add flag to indicate local file handles
Date: Mon, 2 Dec 2024 10:12:49 +1100	[thread overview]
Message-ID: <Z0ztcToKjCY05xq9@dread.disaster.area> (raw)
In-Reply-To: <20241201-work-exportfs-v1-1-b850dda4502a@kernel.org>

On Sun, Dec 01, 2024 at 02:12:25PM +0100, Christian Brauner wrote:
> Some filesystems like kernfs and pidfs support file handles as a
> convenience to use name_to_handle_at(2) and open_by_handle_at(2) but
> don't want to and cannot be reliably exported. Add a flag that allows
> them to mark their export operations accordingly.
> 
> Fixes: aa8188253474 ("kernfs: add exportfs operations")
> Cc: stable <stable@kernel.org> # >= 4.14
> Signed-off-by: Christian Brauner <brauner@kernel.org>
> ---
>  fs/nfsd/export.c         | 8 +++++++-
>  include/linux/exportfs.h | 1 +
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
> index eacafe46e3b673cb306bd3c7caabd3283a1e54b1..786551595cc1c2043e8c195c00ca72ef93c769d6 100644
> --- a/fs/nfsd/export.c
> +++ b/fs/nfsd/export.c
> @@ -417,6 +417,7 @@ static struct svc_export *svc_export_lookup(struct svc_export *);
>  static int check_export(struct path *path, int *flags, unsigned char *uuid)
>  {
>  	struct inode *inode = d_inode(path->dentry);
> +	const struct export_operations *nop;
>  
>  	/*
>  	 * We currently export only dirs, regular files, and (for v4
> @@ -449,11 +450,16 @@ static int check_export(struct path *path, int *flags, unsigned char *uuid)
>  		return -EINVAL;
>  	}
>  
> -	if (!exportfs_can_decode_fh(inode->i_sb->s_export_op)) {
> +	if (!exportfs_can_decode_fh(nop)) {

Where is nop initialised?

>  		dprintk("exp_export: export of invalid fs type.\n");
>  		return -EINVAL;
>  	}
>  
> +	if (nop && nop->flags & EXPORT_OP_LOCAL_FILE_HANDLE) {

Also, please use () around & operations so we can understand that
this is not an accidental typo. i.e:

	if (nop && (nop->flags & EXPORT_OP_LOCAL_FILE_HANDLE)) {

clearly expresses the intent of the code, and now it is obviously
correct at a glance.

-Dave.

-- 
Dave Chinner
david@fromorbit.com

  parent reply	other threads:[~2024-12-01 23:12 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-01 13:12 [PATCH 0/4] exportfs: add flag to allow marking export operations as only supporting file handles Christian Brauner
2024-12-01 13:12 ` [PATCH 1/4] exportfs: add flag to indicate local " Christian Brauner
2024-12-01 13:44   ` Amir Goldstein
2024-12-01 23:12   ` Dave Chinner [this message]
2024-12-02  9:19     ` Christian Brauner
2024-12-01 13:12 ` [PATCH 2/4] kernfs: restrict to " Christian Brauner
2024-12-01 13:12 ` [PATCH 3/4] ovl: restrict to exportable " Christian Brauner
2024-12-01 13:12 ` [PATCH 4/4] pidfs: restrict to local " Christian Brauner
2024-12-01 13:28 ` [PATCH 0/4] exportfs: add flag to allow marking export operations as only supporting " Jeff Layton
2024-12-01 16:22   ` Chuck Lever III
2024-12-03  9:08     ` Christian Brauner
2024-12-03 14:32       ` Jeff Layton
2024-12-01 13:44 ` Amir Goldstein
2024-12-05  0:38 ` Christoph Hellwig
2024-12-05 10:53   ` Christian Brauner
2024-12-05 11:57   ` Amir Goldstein
2024-12-06 16:03     ` Darrick J. Wong
2024-12-07  8:49       ` Amir Goldstein
2024-12-09  7:49         ` Christoph Hellwig
2024-12-09  8:58           ` Amir Goldstein
2024-12-09  9:16             ` Greg KH
2024-12-09 10:02               ` Amir Goldstein
2024-12-09 13:45               ` Christoph Hellwig
2024-12-09 13:46             ` Christoph Hellwig
2024-12-09 16:30               ` Amir Goldstein
2024-12-09 16:35                 ` Chuck Lever
2024-12-09 17:15                   ` Jeff Layton
2024-12-09 17:20                     ` Chuck Lever
2024-12-10 10:13                       ` Christian Brauner
2024-12-10 10:34                         ` Christian Brauner
2024-12-10 11:10                         ` Christoph Hellwig
2024-12-10 12:44                         ` Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z0ztcToKjCY05xq9@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=erin.shepherd@e43.eu \
    --cc=jlayton@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=stable@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox