Thread (8 messages) 8 messages, 4 authors, 2022-11-09

Re: [PATCH v2] nfsd: fix net-namespace logic in __nfsd_file_cache_purge

From: Petr Vorel <pvorel@suse.cz>
Date: 2022-10-31 19:05:45

quoted
On Oct 31, 2022, at 2:46 PM, Jeff Layton [off-list ref] wrote:
quoted
On Mon, 2022-10-31 at 19:45 +0100, Petr Vorel wrote:
quoted
quoted
quoted
quoted
On Oct 31, 2022, at 11:49 AM, Jeff Layton [off-list ref] wrote:
quoted
quoted
quoted
quoted
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.
quoted
quoted
quoted
quoted
Fixes: ce502f81ba88 ("NFSD: Convert the filecache to use rhashtable")
Reported-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/nfsd/filecache.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
quoted
quoted
quoted
Thank you! Applied and pushed to for-rc. I'll send a PR in a few days.
quoted
quoted
Thanks for a quick action!
quoted
No problem. 
quoted
quoted
What a shame you didn't put link to the report, which contains reproducer.
https://lore.kernel.org/ltp/Y1%2FP8gDAcWC%2F+VR3@pevik/ (local)
quoted
quoted
Kind regards,
Petr
quoted
Chuck, could you add that link to the changelog when you merge it?
In progress, I'll push the update in a moment.
Thanks a lot!

Kind regards,
Petr


quoted
Thanks,
Jeff
quoted
quoted
quoted
quoted
The v1 patch applies cleanly to v6.0, but not to Chuck's for-next
branch. This one should be suitable there.
diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
index 98c6b5f51bc8..4a8aa7cd8354 100644
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c
@@ -890,9 +890,8 @@ __nfsd_file_cache_purge(struct net *net)
quoted
quoted
quoted
quoted
		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);
+			if (!net || nf->nf_net == net)
+				nfsd_file_unhash_and_dispose(nf, &dispose);
			nf = rhashtable_walk_next(&iter);
		}
quoted
quoted
quoted
quoted
-- 
2.38.1
quoted
-- 
Jeff Layton [off-list ref]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help