Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp909973rwi; Mon, 31 Oct 2022 08:59:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4RLtkGdHvSn4dbFfxQqyK7/a/cVMkE0ZfXlpFsa3is4I7l0y3jbacXlXegsmGCJRXAJp7o X-Received: by 2002:a05:6402:2409:b0:456:f97b:3794 with SMTP id t9-20020a056402240900b00456f97b3794mr14309749eda.145.1667231941968; Mon, 31 Oct 2022 08:59:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667231941; cv=none; d=google.com; s=arc-20160816; b=pmVc7XJNlvBQB++upHCrH6vs4bGTxiBQSHfpMgFMp1J2cE9XuF2w0ohPlxF0Bcz0RA n242UpXX6vP+RVIggvkhGUIBpO0GxgZ16KMW6L9tI632F8iXTgcdGgi6VnZcQPTYFxaJ PGSHGaJ2OUmKc6+S6YzTkVvXa/+Da/3tkXYLTgT3lxv3Gl+eAGr9E/7AM822fl3h+jos 9iOeeNGQRS/Oi9KKzvz+6LCFdwraZSIZ94K6KMcF/AxUK8cjQy1aaClyUs0rJ8xf/dHv K09wCOq0bmJqJ0V02PpKnWEGv2YBs7L6/GNAejzi4mL5Y23cXQ2w/KnZSICl0B2cI/ao lF4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=s/rm1s+1GzMDJ3rfkr9yS/wroJo3+ZCkMVGrM4/uaA4=; b=kOlCBitYXdlA+WBr3WCPvK5ILvtE7QO6im75G0hrjnY6V9FlKhDQ8XUeoyW7DyTppp QC4mEE6jU4SzZJruqCdaShCyMGzFr3fITX3P8CcDkuoLbYWK+boQkabV9IdMShF620Ng 2x1sKfxN2XvnN46kOeUyYn9L0VSEYuu6duzZW3XiusSRh3p/KM6BuncU9uT0vuf/Fzl7 60W3WkH4S9ZViaVxSIniLMOeZ8kBQTw01MEBM7yPntC6AXH2Mm+hEhVaObTMzfvSil2/ SSVxokyi1sX5M17CThmEviR641fqLTuXLk9VXtJ9g5gWGzOLIu+fgAPDoTJd4rqYTXsg xgbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dyszzq02; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ho18-20020a1709070e9200b00780a240cfd7si9673888ejc.493.2022.10.31.08.58.33; Mon, 31 Oct 2022 08:59:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dyszzq02; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231499AbiJaPt2 (ORCPT + 99 others); Mon, 31 Oct 2022 11:49:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231252AbiJaPt1 (ORCPT ); Mon, 31 Oct 2022 11:49:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9C7311A37 for ; Mon, 31 Oct 2022 08:49:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 641F4B818D8 for ; Mon, 31 Oct 2022 15:49:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B22FEC433D6; Mon, 31 Oct 2022 15:49:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667231363; bh=mQzenvQnaXYTbA27BA5f4F6/RIkPIoxFeU8rI3BICpM=; h=From:To:Cc:Subject:Date:From; b=dyszzq02GS8yvPxnwT7xn3MDK++MBGJBHvNTGByGPlJ0NhblA0XiHmGiPpkO9f9ta BAb98DkZ6z1JsbRmYTyVhZzrcIvRtBNXDEgyCinRHDLyFouQONf+/ZGC4Ou7YrQnvH yO8SdRjs765uTfi+Td5LuKsCjJ6B7v3L5zUVM9yulwItSK5E05HIrDjJCFxYxnqwk0 UUnV+rKkrDUW6IBuEEQ/7Nwf3RJwbIU99b6PpHPXcYLYOdtlyRC7G59EhQLto/G5Cs pne7W6nMEqzGPn+8SDUcXP9i/YyOpCCYdKc7yQNEqsaTsRfClt6J9LTI60o9Y0V37l Iuf4Og51IpFPA== From: Jeff Layton To: chuck.lever@oracle.com Cc: linux-nfs@vger.kernel.org, Petr Vorel Subject: [PATCH v2] nfsd: fix net-namespace logic in __nfsd_file_cache_purge Date: Mon, 31 Oct 2022 11:49:21 -0400 Message-Id: <20221031154921.500620-1-jlayton@kernel.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 Signed-off-by: Jeff Layton --- fs/nfsd/filecache.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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) 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); } -- 2.38.1