From patchwork Fri Mar 17 02:22:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chengen Du X-Patchwork-Id: 1758049 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=LhdtV03I; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Pd7G155mzz1yWp for ; Fri, 17 Mar 2023 13:23:05 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pczkB-0005gU-Td; Fri, 17 Mar 2023 02:22:59 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pczkA-0005eJ-Ja for kernel-team@lists.ubuntu.com; Fri, 17 Mar 2023 02:22:58 +0000 Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 65FAC3F1A0 for ; Fri, 17 Mar 2023 02:22:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1679019778; bh=C1lYb4CHPKMdVsvtnm9O7j9ZM68xKOc8GdajyqA7ooo=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=LhdtV03ILqTitHmw516ilkY5pB8FAeXrBwjOkzCQd4F3VU61TuO3u/JYJlsoCZiu3 RbNfWd/k+Zsxj41ApN0wk0jnir6/jj0sRPB8Tu9ajcN3qyOSPAAnAlHiLY0XNa4vXS pw9kZI5khALoT0SAszJFVBtz5avOhUhc//s8b2Dquo/lX1ei0bXkDm3k8OHIc6tpqO IsEgenHauci5iInqoe4GcFY5cc+Z+/HWOyAYnzzblOgSuR/tVjqiCqNgJW6am2AEbm ykVCVKJ1UUwms6PC8FWukXrv4hPv9C/bxcLQHqBtFebb5kJc07A+gj6Gx5iDReBG2A jJnggd+R4XNcg== Received: by mail-pf1-f197.google.com with SMTP id m12-20020a62f20c000000b0062612a76a08so830812pfh.2 for ; Thu, 16 Mar 2023 19:22:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679019777; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C1lYb4CHPKMdVsvtnm9O7j9ZM68xKOc8GdajyqA7ooo=; b=y8iYKKX3s70AeonlAXO6EUwkP819TMoBB51aGJWdcIKYl0VYFYXg93ar9ZcUGBJyL6 9NbJq7WB39zH7cW60lIOwScq6acXjPniEAjIkYOV+MJqe1OkgIXHaRh9uJgXdegydQe+ RI75hDgmoZ+eeTRs+rqNHcb1xse/pQjEAv/V9XnYBI0vYxUgQMUdCZ8oKuG1YwfsX4Le xWUgQj9ZSyplLvBC6w4D5b8kvrtwxVvR8tv4Cw7/ZGTsG0t3Wy20BBLGj6Wow+GT5+Uc phR0cO7uMGrWe6a2uFyA9xfcvnTga3mJssX+AX3+7pYBckUQKtUTZ+rImqo2wX8Y+2Dv 9LUA== X-Gm-Message-State: AO0yUKVGi5W0dpAi3hthNYNkU6SO/q5oTIgHnhEG/NflZcZNRYQpUa4u gWBWi4fE6V1oWWXAflemmcLVMBQj3ZqyemTLfXp4z6+5U/Qy/ZoR7VfrWy8Zxblwm0Yom0znMAX r2na1YdbTT2XdUMH2NZ9HDQAzQQJccYOioitBjVJLR6CLMHeXjw== X-Received: by 2002:a17:90b:2241:b0:23d:83b:8c5f with SMTP id hk1-20020a17090b224100b0023d083b8c5fmr6450620pjb.29.1679019776921; Thu, 16 Mar 2023 19:22:56 -0700 (PDT) X-Google-Smtp-Source: AK7set8ySrYzD7xwajVVoPT+zrfhdRH9VezaFO/+OyzqwgvGNvbdJpfk2rm8VfuxiAVU7sR8i8348g== X-Received: by 2002:a17:90b:2241:b0:23d:83b:8c5f with SMTP id hk1-20020a17090b224100b0023d083b8c5fmr6450608pjb.29.1679019776646; Thu, 16 Mar 2023 19:22:56 -0700 (PDT) Received: from chengendu.. (111-248-125-11.dynamic-ip.hinet.net. [111.248.125.11]) by smtp.gmail.com with ESMTPSA id u62-20020a17090a51c400b00233afe09177sm3866466pjh.8.2023.03.16.19.22.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 19:22:56 -0700 (PDT) From: Chengen Du To: kernel-team@lists.ubuntu.com Subject: [SRU][Kinetic][PATCH 1/1] NFS: Correct timing for assigning access cache timestamp Date: Fri, 17 Mar 2023 10:22:52 +0800 Message-Id: <20230317022252.24955-2-chengen.du@canonical.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230317022252.24955-1-chengen.du@canonical.com> References: <20230317022252.24955-1-chengen.du@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Chengen Du BugLink: https://bugs.launchpad.net/bugs/2009325 When the user's login time is newer than the cache's timestamp, the original entry in the RB-tree will be replaced by a new entry. Currently, the timestamp is only set if the entry is not found in the RB-tree, which can cause the timestamp to be undefined when the entry exists. This may result in a significant increase in ACCESS operations if the timestamp is set to zero. Signed-off-by: Chengen Du Fixes: 0eb43812c027 ("NFS: Clear the file access cache upon login”) Reviewed-by: Benjamin Coddington Signed-off-by: Anna Schumaker (cherry picked from commit 21fd9e8700de86d1169f6336e97d7a74916ed04a) Signed-off-by: Chengen Du --- fs/nfs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 881a8301ccac..d4ed6880bae4 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -3042,7 +3042,6 @@ static void nfs_access_add_rbtree(struct inode *inode, else goto found; } - set->timestamp = ktime_get_ns(); rb_link_node(&set->rb_node, parent, p); rb_insert_color(&set->rb_node, root_node); list_add_tail(&set->lru, &nfsi->access_cache_entry_lru); @@ -3067,6 +3066,7 @@ void nfs_access_add_cache(struct inode *inode, struct nfs_access_entry *set, cache->fsgid = cred->fsgid; cache->group_info = get_group_info(cred->group_info); cache->mask = set->mask; + cache->timestamp = ktime_get_ns(); /* The above field assignments must be visible * before this item appears on the lru. We cannot easily