Linux-NFS Archive mirror
 help / color / mirror / Atom feed
From: Sagi Grimberg <sagi@grimberg.me>
To: Trond Myklebust <trondmy@kernel.org>,
	Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
	Anna Schumaker <Anna.Schumaker@Netapp.com>
Cc: roi.azarzar@vastdata.com, Shaul Tamari <shaul.tamari@vastdata.com>
Subject: Question on (file) layout recall
Date: Wed, 13 May 2026 12:04:10 +0300	[thread overview]
Message-ID: <1f452f42-d501-4c87-829c-afda85707122@grimberg.me> (raw)

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

Hey,

We are testing basic pNFS layout recall and the client is returning 
NFS4ERR_NOMATCHING_LAYOUT
even though the layout indeed matches [see attached pcap].

 From rpcdebug we see:
--
[11651.765840] pnfs_mark_matching_lsegs_return:Begin lo 00000000a41bafec
[11651.765852] pnfs_mark_matching_lsegs_return: marking lseg 
0000000023944cca iomode 2 offset 0 length 18446744073709551615
[11651.765862] mark_lseg_invalid: lseg 0000000023944cca ref 1
[11651.765867] --> filelayout_free_lseg
[11651.765869] nfs4_print_deviceid: device id= [2a00042]
[11651.765871] --> destroy_ds
[11651.765872]         ds {127.0.0.1:2049,}
                        ref count 0
                        client 000000005491df77
                        cl_exchange_flags 80060000
[11651.765878] pnfs_detach_layout_hdr: freeing layout cache 00000000a41bafec
--
[note tracing is from rocky9.6 kernel, but seems the issue will still 
happen on upstream]

Seems that we match the lseg which has a single reference (file is 
already closed).
Hence mark_lseg_invalid drops the final reference, and removes the lseg, 
however
pnfs_mark_matching_lsegs_return() does not set the layout return info 
specifically
because it does not take into account that the lseg is deleted but the 
lo->plh_return_segs
does not contain it.

What seems to address this issue is the following change:
--
diff --git a/bundle/fs/nfs/callback_proc.c b/bundle/fs/nfs/callback_proc.c
index 3f83ebc8149a..a116b7c1a98c 100644
--- a/bundle/fs/nfs/callback_proc.c
+++ b/bundle/fs/nfs/callback_proc.c
@@ -285,6 +285,7 @@ static u32 initiate_file_draining(struct nfs_client 
*clp,
         }

         pnfs_set_layout_stateid(lo, &args->cbl_stateid, NULL, true);
+       set_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags);
         switch (pnfs_mark_matching_lsegs_return(lo, &free_me_list,
                                 &args->cbl_range,
be32_to_cpu(args->cbl_stateid.seqid))) {
--

This change marks that the layout return is requested (by the server).
It will make the tmp_list be redirected to point to &lo->plh_return_segs and
then !list_empty(&lo->plh_return_segs) is evaluated to true, and the layout
return info is set.

I am not sure if I am missing anything, or if this change is correct, 
however the
client should not return NFS4ERR_NOMATCHING_LAYOUT is a valid layout 
recall afaict.

Thoughts?

[-- Attachment #2: pnfs_failing_recall.pcap --]
[-- Type: application/vnd.tcpdump.pcap, Size: 208820 bytes --]

                 reply	other threads:[~2026-05-13  9:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1f452f42-d501-4c87-829c-afda85707122@grimberg.me \
    --to=sagi@grimberg.me \
    --cc=Anna.Schumaker@Netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=roi.azarzar@vastdata.com \
    --cc=shaul.tamari@vastdata.com \
    --cc=trondmy@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).