Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp1011057imk; Sun, 3 Jul 2022 14:55:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v0XxtHQv+mEVz/bXi7usT+0WKhOimgHBLhFV+jXVZ9i2wLupghKX2CicdYoVxUWN1WJL4M X-Received: by 2002:a05:6402:c47:b0:437:ce2d:c30d with SMTP id cs7-20020a0564020c4700b00437ce2dc30dmr34612565edb.395.1656885346615; Sun, 03 Jul 2022 14:55:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656885346; cv=none; d=google.com; s=arc-20160816; b=YYfPvv9C3YBwDl0X0XUhQk1mVUNPySe7GbBRls+kVuFtOWoQRHAJPTbROIWPmUoukc +zVFqKs4IGXvtBQElfFeYtEkcmePgrohCPj6EdyF9jShqOBXudq1RI/61E2qNFJoF10Q qdBhDkqNp8V8eZ+w9Qgpjfk++cgO2gh8mYkhswoULAVFSyIqrFRav88qUugtwEGIOEa2 EHCgGVybs9eiFTTNz5wYt8fmY9Pwflb0VS2NqZouNoESq5zUrPyqb7TPEz/q+EBY20Ig NKtOUrbSl3ZcUd3h6deMQmjVXrR2XtkE0VB0ViFYvHllObwOnJARYDHdP9BvMqLRqNLk n9iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=McfkW5FgXVmOmLQo7EHgyZNeCP9HbMy8V+hctevhQsk=; b=Tzcob/XGrgfCY2+fwzja5Kd8RP1J1jGMoX8r9eXiSPa8Ita0/ccUe784C9xL6k0Gbj OMgMfOn5Y9VawmMlm/zpCzPr2xUWYhDdyV69k35j7YRBoVCRvjVvdsRA7jO35ltG0DGG fSN2vfIJVVaQPtwL76ZzKv2utRMut18cmUC8WOZstCblOlE78HGozywYSUgt6sS/SmxE tZrCwvEuMVXMMju7Y2h98d/j4/+Su2V9xGhHiz9tcq62x986mlP+xZ+8JC37q5KNUkIS L+VXb5S1es8IOT8QbaI9GodtOW6RTVRcKae/JYi/5tW1XCPnnOStobzcC4RanXKghzl0 fAzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@vastdata.com header.s=google header.b=DZ8Sj1Hg; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vastdata.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp20-20020a170906c15400b0072ab4b5ffdcsi5226923ejc.96.2022.07.03.14.55.03; Sun, 03 Jul 2022 14:55:46 -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=@vastdata.com header.s=google header.b=DZ8Sj1Hg; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vastdata.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229521AbiGCVxN (ORCPT + 99 others); Sun, 3 Jul 2022 17:53:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbiGCVxM (ORCPT ); Sun, 3 Jul 2022 17:53:12 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EA361129 for ; Sun, 3 Jul 2022 14:53:10 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id q9so10860374wrd.8 for ; Sun, 03 Jul 2022 14:53:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vastdata.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=McfkW5FgXVmOmLQo7EHgyZNeCP9HbMy8V+hctevhQsk=; b=DZ8Sj1HgVEn4oHZlNEc3/C7gme0XecZg+HlNJ5Hq/m1U5i7DceP7cLZLuFJNDwKjfe Tku1v5jnLSSVUckJ5tbIEioo4eTJyskzFZDq7KTp28WvKTX03LBL/8+AR+3759belYX6 N+qdsmIze79Pu8iidRnQOGbnXQcNHag+wqh0V3GnPNMj44IChUsSyW6gsWJiepL91ECp QvzUQi2i/VmLQYgwAa8lZM+2lcWmIb3+SmRhZ8GAdg1oT021djkJjTnHIDN3B50oWuPZ 5SEbpMjldXMUqU3eciqf+dfn1r5opTbQewu7jXnTE5Uam5Q56fDkRk7ifA1zkNQNXJ7C lCgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=McfkW5FgXVmOmLQo7EHgyZNeCP9HbMy8V+hctevhQsk=; b=FCRtrQF3d4IVSpqfcMEKJud4vK66slyoS32UMfsvdQjQfKqYFe9f1G321pl/GZ+U6y Ry5SlR+OYMaLmxxqEWe7vEsMvd9FV6ITbdAs7J2pGa0HS7+VEHltKFLRqSq1qiVYj12d VnyxmeP1FnnjN4E9xWj7oRLrKq0q4fkTXsLJVNtvc9nruNb3BOAk19876jxnnqDv7dTC 0p4JXVllgRC7L0ya9pFngYhJ+f7OC8ED9aNC0kv1rc2szQ2ZLPYmi9EXE0yobYShn2iE TOukig9nEaP10iln6q8+rubx23xziP2nLANFybBmJ8EORKFrW84a/JVE0RYY+pqVUf16 4u4g== X-Gm-Message-State: AJIora95rmWuo8xvUcpwA9dNZHOjKcRNvLT6R+5GL8DXfMwq2V6wo1YN 64HP4ZLTdwtFew+Wqxoy37sJv7MJA3qLwQ== X-Received: by 2002:a5d:60c5:0:b0:21d:6afe:8499 with SMTP id x5-20020a5d60c5000000b0021d6afe8499mr1398250wrt.258.1656885189104; Sun, 03 Jul 2022 14:53:09 -0700 (PDT) Received: from gmail.com ([2a0d:6fc2:4951:4400:aa5e:45ff:fee1:90a8]) by smtp.gmail.com with ESMTPSA id az38-20020a05600c602600b003a0323463absm17629460wmb.45.2022.07.03.14.53.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jul 2022 14:53:08 -0700 (PDT) Date: Mon, 4 Jul 2022 00:53:06 +0300 From: Dan Aloni To: Trond Myklebust Cc: linux-nfs@vger.kernel.org Subject: Re: [PATCH 1/4] SUNRPC: Clean up the AUTH cache code Message-ID: <20220703214628.2zzixg62do6d7jhh@gmail.com> References: <20181023163404.27777-1-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181023163404.27777-1-trond.myklebust@hammerspace.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On 2018-10-23 12:34:01, Trond Myklebust wrote: > @@ -456,32 +495,24 @@ rpcauth_prune_expired(struct list_head *free, int nr_to_scan) > > if (nr_to_scan-- == 0) > break; > + if (atomic_read(&cred->cr_count) > 1) { > + rpcauth_lru_remove_locked(cred); > + continue; > + } > /* > * Enforce a 60 second garbage collection moratorium > * Note that the cred_unused list must be time-ordered. > */ > - if (time_in_range(cred->cr_expire, expired, jiffies) && > - test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) { > - freed = SHRINK_STOP; > - break; > - } > - > - list_del_init(&cred->cr_lru); > - number_cred_unused--; > - freed++; > - if (atomic_read(&cred->cr_count) != 0) > + if (!time_in_range(cred->cr_expire, expired, jiffies)) > + continue; > + if (!rpcauth_unhash_cred(cred)) > continue; With `!` flipping the `time_in_range(...)` condition in this past change, looks like we are skipping the head of the LRU which should be pruned, so actual expiry does not happen at all in case there are more than about 100 old items in the LRU. Reverting this, I saw the correct behavior taking place. -- >8 -- Subject: [PATCH] sunrpc: fix expiry of auth creds Due to an inverted condition, instead of pruning the head of the LRU, the loop stopped short at the beginning. Fixes: 95cd623250ad ('SUNRPC: Clean up the AUTH cache code') Signed-off-by: Dan Aloni --- net/sunrpc/auth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 682fcd24bf43..2324d1e58f21 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c @@ -445,7 +445,7 @@ rpcauth_prune_expired(struct list_head *free, int nr_to_scan) * Enforce a 60 second garbage collection moratorium * Note that the cred_unused list must be time-ordered. */ - if (!time_in_range(cred->cr_expire, expired, jiffies)) + if (time_in_range(cred->cr_expire, expired, jiffies)) continue; if (!rpcauth_unhash_cred(cred)) continue; -- 2.23.0 -- Dan Aloni