linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nfs: Subsequent READDIR calls should carry non-zero cookieverifier
@ 2021-03-16 10:25 Nagendra Tomar
  2021-03-16 13:38 ` Trond Myklebust
  0 siblings, 1 reply; 2+ messages in thread
From: Nagendra Tomar @ 2021-03-16 10:25 UTC (permalink / raw)
  To: linux-nfs@vger.kernel.org; +Cc: Trond Myklebust, Anna Schumaker

From: Nagendra S Tomar <natomar@microsoft.com>

If the loop in nfs_readdir_xdr_to_array() runs more than once, subsequent
READDIR RPCs may wrongly carry a zero cookie verifier and non-zero cookie.
Make sure subsequent calls to READDIR carry the cookie verifier returned
by the first call.

Signed-off-by: Nagendra S Tomar <natomar@microsoft.com>
---
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index fc4f490f2d78..08a1e2e31d0b 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -866,6 +866,8 @@ static int nfs_readdir_xdr_to_array(struct nfs_readdir_descriptor *desc,
 			break;
 		}
 
+		verf_arg = verf_res;
+
 		status = nfs_readdir_page_filler(desc, entry, pages, pglen,
 						 arrays, narrays);
 	} while (!status && nfs_readdir_page_needs_filling(page));

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

* Re: [PATCH] nfs: Subsequent READDIR calls should carry non-zero cookieverifier
  2021-03-16 10:25 [PATCH] nfs: Subsequent READDIR calls should carry non-zero cookieverifier Nagendra Tomar
@ 2021-03-16 13:38 ` Trond Myklebust
  0 siblings, 0 replies; 2+ messages in thread
From: Trond Myklebust @ 2021-03-16 13:38 UTC (permalink / raw)
  To: linux-nfs@vger.kernel.org, Nagendra.Tomar@microsoft.com
  Cc: anna.schumaker@netapp.com

On Tue, 2021-03-16 at 10:25 +0000, Nagendra Tomar wrote:
> From: Nagendra S Tomar <natomar@microsoft.com>
> 
> If the loop in nfs_readdir_xdr_to_array() runs more than once,
> subsequent
> READDIR RPCs may wrongly carry a zero cookie verifier and non-zero
> cookie.
> Make sure subsequent calls to READDIR carry the cookie verifier
> returned
> by the first call.
> 
> Signed-off-by: Nagendra S Tomar <natomar@microsoft.com>
> ---
> diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
> index fc4f490f2d78..08a1e2e31d0b 100644
> --- a/fs/nfs/dir.c
> +++ b/fs/nfs/dir.c
> @@ -866,6 +866,8 @@ static int nfs_readdir_xdr_to_array(struct
> nfs_readdir_descriptor *desc,
>                         break;
>                 }
>  
> +               verf_arg = verf_res;
> +
>                 status = nfs_readdir_page_filler(desc, entry, pages,
> pglen,
>                                                  arrays, narrays);
>         } while (!status && nfs_readdir_page_needs_filling(page));

That looks good to me. However when looking over that code, I think I
spotted a similar issue when we're doing uncached readdir in order to
try to recover a missing cookie. I therefore Cced you on the posting
for that patch.

-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com



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

end of thread, other threads:[~2021-03-16 13:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-16 10:25 [PATCH] nfs: Subsequent READDIR calls should carry non-zero cookieverifier Nagendra Tomar
2021-03-16 13:38 ` Trond Myklebust

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 NNTP newsgroup(s).