public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Chuck Lever" <cel@kernel.org>
To: "Christoph Hellwig" <hch@lst.de>,
	"Chuck Lever" <chuck.lever@oracle.com>,
	"Jeff Layton" <jlayton@kernel.org>,
	"Amir Goldstein" <amir73il@gmail.com>
Cc: NeilBrown <neil@brown.name>,
	"Olga Kornievskaia" <okorniev@redhat.com>,
	"Dai Ngo" <Dai.Ngo@oracle.com>, "Tom Talpey" <tom@talpey.com>,
	"Carlos Maiolino" <cem@kernel.org>,
	linux-nfs@vger.kernel.org, linux-xfs@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 1/7] exportfs: split out the ops for layout-based block device access
Date: Mon, 23 Mar 2026 09:39:48 -0400	[thread overview]
Message-ID: <1fbdc5d9-d95c-4d1a-816e-028ffd1231b0@app.fastmail.com> (raw)
In-Reply-To: <20260323070746.2940140-2-hch@lst.de>



On Mon, Mar 23, 2026, at 3:07 AM, Christoph Hellwig wrote:

> diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c
> index ad7af8cfcf1f..616984fe3873 100644
> --- a/fs/nfsd/nfs4layouts.c
> +++ b/fs/nfsd/nfs4layouts.c
> @@ -3,6 +3,7 @@
>   * Copyright (c) 2014 Christoph Hellwig.
>   */
>  #include <linux/blkdev.h>
> +#include <linux/exportfs_block.h>
>  #include <linux/kmod.h>
>  #include <linux/file.h>
>  #include <linux/jhash.h>
> @@ -127,6 +128,7 @@ void nfsd4_setup_layout_type(struct svc_export *exp)
>  {
>  #if defined(CONFIG_NFSD_BLOCKLAYOUT) || defined(CONFIG_NFSD_SCSILAYOUT)
>  	struct super_block *sb = exp->ex_path.mnt->mnt_sb;
> +	struct exportfs_block_ops *bops = sb->s_export_op->block_ops;
>  #endif
> 
>  	if (!(exp->ex_flags & NFSEXP_PNFS))
> @@ -136,14 +138,11 @@ void nfsd4_setup_layout_type(struct svc_export *exp)
>  	exp->ex_layout_types |= 1 << LAYOUT_FLEX_FILES;
>  #endif
>  #ifdef CONFIG_NFSD_BLOCKLAYOUT
> -	if (sb->s_export_op->get_uuid &&
> -	    sb->s_export_op->map_blocks &&
> -	    sb->s_export_op->commit_blocks)
> +	if (bops->get_uuid && bops->map_blocks && bops->commit_blocks)
>  		exp->ex_layout_types |= 1 << LAYOUT_BLOCK_VOLUME;
>  #endif
>  #ifdef CONFIG_NFSD_SCSILAYOUT
> -	if (sb->s_export_op->map_blocks &&
> -	    sb->s_export_op->commit_blocks &&
> +	if (bops->map_blocks && bops->commit_blocks &&
>  	    sb->s_bdev &&
>  	    sb->s_bdev->bd_disk->fops->pr_ops &&
>  	    sb->s_bdev->bd_disk->fops->get_unique_id)

block_ops itself is NULL for any filesystem that does not provide
block layout support (everything other than XFS today).

When an admin exports such a filesystem with pNFS enabled
(NFSEXP_PNFS), svc_export_parse() calls nfsd4_setup_layout_type(),
and bops->get_uuid dereferences a NULL pointer.

Something like the following would restore the original behavior:

    if (bops && bops->get_uuid && ...)


-- 
Chuck Lever

  reply	other threads:[~2026-03-23 13:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23  7:07 support multiple block devices per file system for block-style layouts Christoph Hellwig
2026-03-23  7:07 ` [PATCH 1/7] exportfs: split out the ops for layout-based block device access Christoph Hellwig
2026-03-23 13:39   ` Chuck Lever [this message]
2026-03-26  5:33     ` Christoph Hellwig
2026-03-23  7:07 ` [PATCH 2/7] exportfs: don't pass struct iattr to ->commit_blocks Christoph Hellwig
2026-03-23 14:05   ` Chuck Lever
2026-03-26  5:36     ` Christoph Hellwig
2026-03-23  7:07 ` [PATCH 3/7] exportfs,nfsd: rework checking for layout-based block device access support Christoph Hellwig
2026-03-23  7:07 ` [PATCH 4/7] nfsd: support multiple pNFS device IDs Christoph Hellwig
2026-03-23  7:07 ` [PATCH 5/7] nfsd/blocklayout: support GETDEVICEINFO for multiple devices Christoph Hellwig
2026-03-23 13:53   ` Chuck Lever
2026-03-26  5:38     ` Christoph Hellwig
2026-03-26 12:37       ` Chuck Lever
2026-03-23  7:07 ` [PATCH 6/7] exportfs: return a device index from ->map_blocks Christoph Hellwig
2026-03-23  7:07 ` [PATCH 7/7] xfs: support layout-based block device access on the RT device Christoph Hellwig

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=1fbdc5d9-d95c-4d1a-816e-028ffd1231b0@app.fastmail.com \
    --to=cel@kernel.org \
    --cc=Dai.Ngo@oracle.com \
    --cc=amir73il@gmail.com \
    --cc=cem@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=hch@lst.de \
    --cc=jlayton@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=okorniev@redhat.com \
    --cc=tom@talpey.com \
    /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