Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp762164rwl; Thu, 5 Jan 2023 04:17:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXteTW221pPSqqw3hijtkJtojJq7QEJKSpadFWshnxjhfvUIQZOzsg/c2AvyI4YTCLLHFcmU X-Received: by 2002:a17:90a:d58a:b0:219:7d75:de7b with SMTP id v10-20020a17090ad58a00b002197d75de7bmr52919091pju.35.1672921063459; Thu, 05 Jan 2023 04:17:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672921063; cv=none; d=google.com; s=arc-20160816; b=QMuzkM8Dav/Cd1iNCKegETv7KKZ/mFroeAkfa2oWx5v5Sq7cOmwhvh1QSoAYFi1cED jFwTHiPTY0KT0f3yU73CUT/r3valUPlBPtT+1iziSo3Usb3Myd2l2dVLxnCqC+Q1EVfs wI/9tDEVv4JaFU8nHmHk45AaGtdNeh9KlW9HvtUdqo0nJaCycq68+Zvkd0h5jU8BQ2tq TCs0Ro37fLdRgPZ4dHHwu2A0JqtAPvyx1QAeJ2GynuaqYcWg9Y5A1L6vy5n+iS0tdjok 6zpRM4wiAvca/Bk00kvvT6ronomI8zK8dE96gPrhpqqYqBpmCHi1fHbVIQ+lqlhZ01Mc eFXA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fCBEypEFCcU3uQUTaZOZmSqSztZ20CIULT+ms6QaKV4=; b=cy16HGAhFO74jBktpJqeJcXo0jVgmV4XFfzKrGXCTKlDQ48qbxPZX4vaTHmTM1+0Pc qZfgke6NFkLhEDvsYeBCehMaNKnJxX9a7Qq5jQcshRZCT2XinEfo7e0w1ah8qRvVjRAN 4kGRji2eer/D0ZjKYmfA3kDd/siEE1DRufHh9SmXkUuJsSvjuAfzq5tyZsRIdk+eclaL Ocw0glVBTJYXiFj820iDISr5M+NEuq5OM5ssvHFLChnPlnC1oqi02/XsgQ6uRxH/5l2C iXcWToM3SjNt7DI9NjCPda+tEIYDIf45mpu1jWjr/ribrP8Ijer6V9P8ZfY8v8dYvVyl 4ebQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=peUE5QdY; 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 p4-20020a17090ac00400b00200b5c30f73si1659811pjt.106.2023.01.05.04.17.31; Thu, 05 Jan 2023 04:17:43 -0800 (PST) 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=peUE5QdY; 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 S232101AbjAEMPW (ORCPT + 99 others); Thu, 5 Jan 2023 07:15:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232987AbjAEMPU (ORCPT ); Thu, 5 Jan 2023 07:15:20 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4E1444C7B for ; Thu, 5 Jan 2023 04:15:19 -0800 (PST) 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 50868B81AC6 for ; Thu, 5 Jan 2023 12:15:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE222C433EF; Thu, 5 Jan 2023 12:15:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672920917; bh=64ox1Dctbnqwo17SUA9JBVAOHUOogbmQ/K52bJnkFSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=peUE5QdY+WenaSEZTbR0mpAQHgjmtEWxkp2O3V9blJAc8ROYvbDCpgWp5RlxZY6tF RXI5JLRWfm9wTACgAw69rF7Q69ZDadWQ/PnzDEVUXCJ+bxy8iuELEqMCF+J+FbjZCK 36NOURRIxG9dfnEwp5TGtDYzxF425GYKHzmRHctewBQDvqaoS0wIV4CGieuEkqY2ui G85hr9q2OPgQsBEpbYSX9s3t8ai+RFBNxP+nM8tS66vNIcgmLrRb9TbkxzEenYf2HB SskWAwMSrPcHOF7UW6GEbF8Q6VAjwwkjs/cvRxo2uUrMz5mS1QRZRKcHRGQM/6OrRw ER8k7aFS6gZNg== From: Jeff Layton To: chuck.lever@oracle.com Cc: linux-nfs@vger.kernel.org, David Howells Subject: [PATCH 4/4] nfsd: add some comments to nfsd_file_do_acquire Date: Thu, 5 Jan 2023 07:15:12 -0500 Message-Id: <20230105121512.21484-5-jlayton@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230105121512.21484-1-jlayton@kernel.org> References: <20230105121512.21484-1-jlayton@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.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 David Howells mentioned that he found this bit of code confusing, so sprinkle in some comments to clarify. Reported-by: David Howells Signed-off-by: Jeff Layton --- fs/nfsd/filecache.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c index f0ca9501edb2..5724baad09ec 100644 --- a/fs/nfsd/filecache.c +++ b/fs/nfsd/filecache.c @@ -1105,6 +1105,11 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp, rcu_read_unlock(); if (nf) { + /* + * If the nf is on the LRU then it holds an extra reference + * that must be put if it's removed. It had better not be + * the last one however, since we should hold another. + */ if (nfsd_file_lru_remove(nf)) WARN_ON_ONCE(refcount_dec_and_test(&nf->nf_ref)); goto wait_for_construction; -- 2.39.0