Re: [PATCH 4/4] exportfs,nfsd: rework checking for layout-based block device access support

Jeff Layton
2026-04-13T22:28:21Z

On Wed, 2026-04-01 at 16:40 +0200, Christoph Hellwig wrote:
> Currently NFSD hard codes checking support for block-style layouts.
> Lift the checks into a file system-helper and provide a exportfs-level
> helper to implement the typical checks.
>
> This prepares for supporting block layout export of multiple devices
> per file system.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Jeff Layton <jlayton@kernel.org>
> ---
> fs/nfsd/export.c | 3 +-
> fs/nfsd/nfs4layouts.c | 26 +++++------------
> fs/xfs/xfs_pnfs.c | 13 +++++++++
> include/linux/exportfs_block.h | 52 +++++++++++++++++++++++++++++++++-
> 4 files changed, 73 insertions(+), 21 deletions(-)
>
> diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
> index 8e8a76a44ff0..e20298f9212f 100644
> --- a/fs/nfsd/export.c
> +++ b/fs/nfsd/export.c
> @@ -735,7 +735,8 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
> goto out4;
> err = 0;
>
> - nfsd4_setup_layout_type(&exp);
> + if (exp.ex_flags & NFSEXP_PNFS)
> + nfsd4_setup_layout_type(&exp);
> }
>

There is a (minor) problem with this patch. There is a second call to
nfsd4_setup_layout_type() in Chuck's nfsd-next branch, in
nfsd_nl_parse_one_export(). It needs to be gated on this flag now, or
we end up enabling pnfs unconditionally.

--
Jeff Layton <jlayton@kernel.org>