Re: [PATCH 5.15 463/690] nfsd: fix net-namespace logic in __nfsd_file_cache_purge

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

> 5.15-stable review patch.  If anyone has any objections, please let me know.

> ------------------

> From: Jeff Layton <jlayton@xxxxxxxxxx>

> [ Upstream commit d3aefd2b29ff5ffdeb5c06a7d3191a027a18cdb8 ]

> If the namespace doesn't match the one in "net", then we'll continue,
> but that doesn't cause another rhashtable_walk_next call, so it will
> loop infinitely.

> Fixes: ce502f81ba88 ("NFSD: Convert the filecache to use rhashtable")
> Reported-by: Petr Vorel <pvorel@xxxxxxx>
> Link: https://lore.kernel.org/ltp/Y1%2FP8gDAcWC%2F+VR3@pevik/
> Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
> Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
> ---
>  fs/nfsd/filecache.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

> diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
> index 0b19eb015c6c8..024adcbe67e95 100644
> --- a/fs/nfsd/filecache.c
> +++ b/fs/nfsd/filecache.c
> @@ -892,9 +892,8 @@ __nfsd_file_cache_purge(struct net *net)

>  		nf = rhashtable_walk_next(&iter);
>  		while (!IS_ERR_OR_NULL(nf)) {
> -			if (net && nf->nf_net != net)
> -				continue;
> -			nfsd_file_unhash_and_dispose(nf, &dispose);
I don't know the context (whether the fix is needed for 5.15 and older), but
patch does not apply because nfsd_file_unhash_and_dispose() was introduced in
ce502f81ba88 ("NFSD: Convert the filecache to use rhashtable") in v6.0-rc1.  It
was actually renamed from nfsd_file_unhash_and_release_locked() in that commit.
Also the context changed - nfsd_file_unhash_and_dispose() was introduced in the
commit which is supposed to be fixed in this commit, one would say that this fix
is not needed in older kernels (5.15, 5.10 and 5.4; 4.19 has completely
different code). But that's a question for Jeff or Chuck.

Kind regards,
Petr

> +			if (!net || nf->nf_net == net)
> +				nfsd_file_unhash_and_dispose(nf, &dispose);
>  			nf = rhashtable_walk_next(&iter);
>  		}




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux