mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] nfsd: don't offer flexfiles layouts when NFSv3 isn't being served
@ 2026-09-04 16:11 Jeff Layton
  2026-09-04 17:47 ` Chuck Lever
  2026-09-04 19:04 ` Rick Macklem
  0 siblings, 2 replies; 4+ messages in thread
From: Jeff Layton @ 2026-09-04 16:11 UTC (permalink / raw)
  To: Chuck Lever, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Tom Haynes
  Cc: linux-nfs, linux-kernel, Benji Wiebe, Jeff Layton

The flexfiles layout driver hands out a deviceinfo that names this server
as an NFSv3 DS (flexfilelayout.c hardcodes da->version = 3). With v3
disabled, the client can't talk to the DS: it loops on v3 NULL calls that
the server answers with PROG_MISMATCH, and I/O hangs in D state.

Skip LAYOUT_FLEX_FILES in nfsd4_setup_layout_type() unless v3 is enabled.

Reported-by: Benji Wiebe <itsme@benjiwiebe.com>
Closes: https://lore.kernel.org/linux-nfs/c734eeb8-8486-4491-bb4d-b9656cbaffbe@app.fastmail.com/
Fixes: 9b9960a0ca47 ("nfsd: Add a super simple flex file server")
Assisted-by: LLM
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/nfsd/nfs4layouts.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c
index 22bcb6d09f70..cef4d40c89a2 100644
--- a/fs/nfsd/nfs4layouts.c
+++ b/fs/nfsd/nfs4layouts.c
@@ -127,10 +127,12 @@ nfsd4_set_deviceid(struct nfsd4_deviceid *id, const struct svc_fh *fhp,
 
 void nfsd4_setup_layout_type(struct svc_export *exp)
 {
+	struct nfsd_net *nn = net_generic(exp->cd->net, nfsd_net_id);
 	struct super_block *sb = exp->ex_path.mnt->mnt_sb;
 	expfs_block_layouts_t block_supported = exportfs_layouts_supported(sb);
 
-	if (IS_ENABLED(CONFIG_NFSD_FLEXFILELAYOUT))
+	if (IS_ENABLED(CONFIG_NFSD_FLEXFILELAYOUT) &&
+	    nfsd_vers(nn, 3, NFSD_TEST))
 		exp->ex_layout_types |= 1 << LAYOUT_FLEX_FILES;
 	if (IS_ENABLED(CONFIG_NFSD_BLOCKLAYOUT) &&
 	    (block_supported & EXPFS_BLOCK_IN_BAND_ID))

---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260904-pnfs-ff-485ac21042a6

Best regards,
-- 
Jeff Layton <jlayton@kernel.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nfsd: don't offer flexfiles layouts when NFSv3 isn't being served
  2026-09-04 16:11 [PATCH] nfsd: don't offer flexfiles layouts when NFSv3 isn't being served Jeff Layton
@ 2026-09-04 17:47 ` Chuck Lever
  2026-09-04 19:04 ` Rick Macklem
  1 sibling, 0 replies; 4+ messages in thread
From: Chuck Lever @ 2026-09-04 17:47 UTC (permalink / raw)
  To: NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey, Tom Haynes,
	Jeff Layton
  Cc: linux-nfs, linux-kernel, Benji Wiebe

On Fri, 04 Sep 2026 12:11:37 -0400, Jeff Layton wrote:
> The flexfiles layout driver hands out a deviceinfo that names this server
> as an NFSv3 DS (flexfilelayout.c hardcodes da->version = 3). With v3
> disabled, the client can't talk to the DS: it loops on v3 NULL calls that
> the server answers with PROG_MISMATCH, and I/O hangs in D state.
> 
> Skip LAYOUT_FLEX_FILES in nfsd4_setup_layout_type() unless v3 is enabled.
> 
> [...]

Applied to nfsd-testing, thanks! I can drop this one if you find a
better solution.

[1/1] nfsd: don't offer flexfiles layouts when NFSv3 isn't being served
      commit: c1efd0d304fb61af95f4919936dc11a94845532d

--
Chuck Lever


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nfsd: don't offer flexfiles layouts when NFSv3 isn't being served
  2026-09-04 16:11 [PATCH] nfsd: don't offer flexfiles layouts when NFSv3 isn't being served Jeff Layton
  2026-09-04 17:47 ` Chuck Lever
@ 2026-09-04 19:04 ` Rick Macklem
  2026-09-05 14:37   ` Mkrtchyan, Tigran
  1 sibling, 1 reply; 4+ messages in thread
From: Rick Macklem @ 2026-09-04 19:04 UTC (permalink / raw)
  To: Jeff Layton
  Cc: Chuck Lever, NeilBrown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Tom Haynes, linux-nfs, linux-kernel, Benji Wiebe

On Fri, Sep 4, 2026 at 9:50 AM Jeff Layton <jlayton@kernel.org> wrote:
>
> The flexfiles layout driver hands out a deviceinfo that names this server
> as an NFSv3 DS (flexfilelayout.c hardcodes da->version = 3). With v3
> disabled, the client can't talk to the DS: it loops on v3 NULL calls that
> the server answers with PROG_MISMATCH, and I/O hangs in D state.
>
> Skip LAYOUT_FLEX_FILES in nfsd4_setup_layout_type() unless v3 is enabled.
>
> Reported-by: Benji Wiebe <itsme@benjiwiebe.com>
> Closes: https://lore.kernel.org/linux-nfs/c734eeb8-8486-4491-bb4d-b9656cbaffbe@app.fastmail.com/
> Fixes: 9b9960a0ca47 ("nfsd: Add a super simple flex file server")
> Assisted-by: LLM
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>  fs/nfsd/nfs4layouts.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c
> index 22bcb6d09f70..cef4d40c89a2 100644
> --- a/fs/nfsd/nfs4layouts.c
> +++ b/fs/nfsd/nfs4layouts.c
> @@ -127,10 +127,12 @@ nfsd4_set_deviceid(struct nfsd4_deviceid *id, const struct svc_fh *fhp,
>
>  void nfsd4_setup_layout_type(struct svc_export *exp)
>  {
> +       struct nfsd_net *nn = net_generic(exp->cd->net, nfsd_net_id);
>         struct super_block *sb = exp->ex_path.mnt->mnt_sb;
>         expfs_block_layouts_t block_supported = exportfs_layouts_supported(sb);
>
> -       if (IS_ENABLED(CONFIG_NFSD_FLEXFILELAYOUT))
> +       if (IS_ENABLED(CONFIG_NFSD_FLEXFILELAYOUT) &&
> +           nfsd_vers(nn, 3, NFSD_TEST))
>                 exp->ex_layout_types |= 1 << LAYOUT_FLEX_FILES;
>         if (IS_ENABLED(CONFIG_NFSD_BLOCKLAYOUT) &&
>             (block_supported & EXPFS_BLOCK_IN_BAND_ID))
Although most ffv1 servers use NFSv3 DSs, it is possible for an ffv1
layout to specify NFSv4.

rick
ps: I don't know how you'd check to see if the layout will be an
      NFSv3 one. (If the server only does NFSv3 layouts, then I'd
      guess this patch is ok?)

>
> ---
> base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
> change-id: 20260904-pnfs-ff-485ac21042a6
>
> Best regards,
> --
> Jeff Layton <jlayton@kernel.org>
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nfsd: don't offer flexfiles layouts when NFSv3 isn't being served
  2026-09-04 19:04 ` Rick Macklem
@ 2026-09-05 14:37   ` Mkrtchyan, Tigran
  0 siblings, 0 replies; 4+ messages in thread
From: Mkrtchyan, Tigran @ 2026-09-05 14:37 UTC (permalink / raw)
  To: Rick Macklem
  Cc: Jeff Layton, Chuck Lever, NeilBrown, Olga Kornievskaia, Dai Ngo,
	Tom Talpey, Tom Haynes, linux-nfs, linux-kernel, Benji Wiebe

[-- Attachment #1: Type: text/plain, Size: 3313 bytes --]

Hi Rick,

our server runs with v4.1 DSes whenissues FF layouts.
The patch is touching server side only, so I hope the
client side still works as expected. For quite some time
I had submitted a patch[0] that decomples ff layout driver
from v3 client so that client still can use v4.1 DSes
ever if v3 client in not compiled.

[0]: a68c6fbb638a "nfs41: drop dependency between flexfiles layout driver and NFSv3 modules"

Best regards,
   Tigran.


----- Original Message -----
> From: "Rick Macklem" <rick.macklem@gmail.com>
> To: "Jeff Layton" <jlayton@kernel.org>
> Cc: "Chuck Lever" <cel@kernel.org>, "NeilBrown" <neil@brown.name>, "Olga Kornievskaia" <okorniev@redhat.com>, "Dai Ngo"
> <Dai.Ngo@oracle.com>, "Tom Talpey" <tom@talpey.com>, "Tom Haynes" <thomas.haynes@hammerspace.com>, "linux-nfs"
> <linux-nfs@vger.kernel.org>, "linux-kernel" <linux-kernel@vger.kernel.org>, "Benji Wiebe" <itsme@benjiwiebe.com>
> Sent: Friday, 4 September, 2026 21:04:18
> Subject: Re: [PATCH] nfsd: don't offer flexfiles layouts when NFSv3 isn't being served

> On Fri, Sep 4, 2026 at 9:50 AM Jeff Layton <jlayton@kernel.org> wrote:
>>
>> The flexfiles layout driver hands out a deviceinfo that names this server
>> as an NFSv3 DS (flexfilelayout.c hardcodes da->version = 3). With v3
>> disabled, the client can't talk to the DS: it loops on v3 NULL calls that
>> the server answers with PROG_MISMATCH, and I/O hangs in D state.
>>
>> Skip LAYOUT_FLEX_FILES in nfsd4_setup_layout_type() unless v3 is enabled.
>>
>> Reported-by: Benji Wiebe <itsme@benjiwiebe.com>
>> Closes:
>> https://lore.kernel.org/linux-nfs/c734eeb8-8486-4491-bb4d-b9656cbaffbe@app.fastmail.com/
>> Fixes: 9b9960a0ca47 ("nfsd: Add a super simple flex file server")
>> Assisted-by: LLM
>> Signed-off-by: Jeff Layton <jlayton@kernel.org>
>> ---
>>  fs/nfsd/nfs4layouts.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c
>> index 22bcb6d09f70..cef4d40c89a2 100644
>> --- a/fs/nfsd/nfs4layouts.c
>> +++ b/fs/nfsd/nfs4layouts.c
>> @@ -127,10 +127,12 @@ nfsd4_set_deviceid(struct nfsd4_deviceid *id, const struct
>> svc_fh *fhp,
>>
>>  void nfsd4_setup_layout_type(struct svc_export *exp)
>>  {
>> +       struct nfsd_net *nn = net_generic(exp->cd->net, nfsd_net_id);
>>         struct super_block *sb = exp->ex_path.mnt->mnt_sb;
>>         expfs_block_layouts_t block_supported = exportfs_layouts_supported(sb);
>>
>> -       if (IS_ENABLED(CONFIG_NFSD_FLEXFILELAYOUT))
>> +       if (IS_ENABLED(CONFIG_NFSD_FLEXFILELAYOUT) &&
>> +           nfsd_vers(nn, 3, NFSD_TEST))
>>                 exp->ex_layout_types |= 1 << LAYOUT_FLEX_FILES;
>>         if (IS_ENABLED(CONFIG_NFSD_BLOCKLAYOUT) &&
>>             (block_supported & EXPFS_BLOCK_IN_BAND_ID))
> Although most ffv1 servers use NFSv3 DSs, it is possible for an ffv1
> layout to specify NFSv4.
> 
> rick
> ps: I don't know how you'd check to see if the layout will be an
>      NFSv3 one. (If the server only does NFSv3 layouts, then I'd
>      guess this patch is ok?)
> 
>>
>> ---
>> base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
>> change-id: 20260904-pnfs-ff-485ac21042a6
>>
>> Best regards,
>> --
>> Jeff Layton <jlayton@kernel.org>
>>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 2309 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-05 14:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-04 16:11 [PATCH] nfsd: don't offer flexfiles layouts when NFSv3 isn't being served Jeff Layton
2026-09-04 17:47 ` Chuck Lever
2026-09-04 19:04 ` Rick Macklem
2026-09-05 14:37   ` Mkrtchyan, Tigran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®