From patchwork Mon Nov 11 20:16:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 179132 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp7142972ilf; Mon, 11 Nov 2019 12:17:30 -0800 (PST) X-Google-Smtp-Source: APXvYqwpFDabFfpUCfjwAy5puqKv4j1vZSb43uJMgjyoyAwFVJuAfocQHVRzCgPvY2QUkzGh6G1Q X-Received: by 2002:a17:906:14d4:: with SMTP id y20mr24691009ejc.21.1573503450101; Mon, 11 Nov 2019 12:17:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573503450; cv=none; d=google.com; s=arc-20160816; b=UaLRJLvQkJ/T9nL3+wRS5ofn5HFCiliXgTVkAXC+YzkXJptyzlZoUZYqVu/07CAS1o naIQqZlLy7oKRhQctcaH0P2fq45DcrHuh7rWoMj3vOe6qfUQsDe44H8TAafRzeYDZOx3 VTszoombBhBHHl8b8vW7QT0Kpq9RGNVYxqfrIsTJmd63oH4/avmyE3KDaOHVKQIu75u/ BqkD5v1d/iYazkTrn+/rDyWaAUOIiWdZ6sVlKNNLC1rvopiV2+IFFvzrMcSjI5iNPXaG RcLVZsBYioVQQhGvSBS1tB1cuYv+SHXT2Q3NbrsXPTODrJCQDS3Vw/ZbWjrfAAVQDnIz dQrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=NgSuRYXD25egMNBNk8g0f3hUNh0bK7dnM17BNUKDNgQ=; b=O4XNYt6qEkQdtBqMrdBEKVwEQMwA5YDTZLzs9lFd5Shs8GqFOctLfRA8xapFP3L243 Oe8mK8Of2byFf9GdLEuiwMMGpNA3/IgunfTVqJek4KZRmRmVTiI6b0qGY12i25PY2G0j WwU0SbZkzVt+MlLPLOP7VxEB/4pCuBW7WDM3CgdtnU0GGnim3UeoFuTnEkYgztWicNni hgkUJuW34MH6DRF8XDuD7D8bxVf4h2mJGV8GHW+2RBt7UCnipyspdvEvHpYj4Izysidw LK/EcbwA4TDQnDkctArUIHBY2BdW84JpyRBcJLheahrncPv6AWzRy3/fYDKR2/Klz0Ar oR7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w27si11947807eda.296.2019.11.11.12.17.29; Mon, 11 Nov 2019 12:17:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727735AbfKKUR1 (ORCPT + 26 others); Mon, 11 Nov 2019 15:17:27 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:53755 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727531AbfKKURF (ORCPT ); Mon, 11 Nov 2019 15:17:05 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1Mwwm5-1hfl1c2bHv-00yR5A; Mon, 11 Nov 2019 21:16:51 +0100 From: Arnd Bergmann To: linux-nfs@vger.kernel.org, "J. Bruce Fields" , Chuck Lever , Trond Myklebust , Anna Schumaker Cc: y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH 16/19] nfsd: fix jiffies/time_t mixup in LRU list Date: Mon, 11 Nov 2019 21:16:36 +0100 Message-Id: <20191111201639.2240623-17-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191111201639.2240623-1-arnd@arndb.de> References: <20191111201639.2240623-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:AH8i1QyjBnmOgX+Hph5q/HZDFvvmSil4F4O+Bsp1GBARUSPR52L oJj8k7tJxTPm8H3PYTDBGT5Kf6ImwYCV/Mbg0OPMDkv9pdGxcDg/0bjWFERI6HLp8xzSX9J ixTYcoCBHyaZoFmRJMdqLFk79jkYGlaOW0hPkIPun8C++agV/XpkFXdIHMbwNrryvm4P3ix d2L6RsC6qjcI08EKf5UEw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:Sh4EoJu1FJ0=:q2VPo+fnLWnNCS+UeuYzw1 qXUBzU4zX7fHNjgxQ0AyM0uzAWi4xzEdFhvP0TmDK5iNplav4fmxRGBgqZVrSDvIpwut0QFHt 5JLrWLuUfdwoikzjVFQfEZupDo0PZjEzaPn5rEmNuvuwK0IJAONBwAqll6mbnkE3Y+QQcRcwP XzdggbnvtlViky0kxRMLr0QeofeNoyMivV9W8HGY5ajhutREIDm/KohHoJCIUc4V59uOv7MSU Ly3oyeM1PIzngbIgbIJGGc26x2JYmUuL7YhlVh8dKGoowAODJyDcIimuo7ltqhH9eTcuI75Ud FhGMdFIA1vQvxKkBaf5SkhAYr+PEIbwylF6aI38HWbEnyFMNrwG9/nWtxQs26Iqfdz3TJfgx5 DOhO9Bq66P8xC3kiQKg7HkwLp1lepCiDYs1vcBbtpI/yZ/nyOkU3JrvDANePniQk1fKIpuwUs 768DD/FuK5uhEBtZNTvq624Ec2PccKq/vXXtLT7gMUJ7FM+F1iS/CU3qtJl5KS+q9c9nn5Yu9 5ZV4p2SXsYb1pAlRWxaURIGOT5JvU2kf378Lzz8EvyEJf+Q/WJa4pgLx/ih9p9xn8NDx/LHN6 c5DPqSRfybLg9JIU3r52w5+5cM8BeqwCtSF5IK9/VmPk9xpovGNnhuW75FwtKzn+aNarlHCyu y9kPmuCagplHhxHTjEVuZJDGj8U+wHmATkc8zLts5Y0GUoWdrsdSWocjUHTioMw3g0cE3aEek rYFB4pPXY5VHDixHp5l6f/PLq0AXg2Dq207bhzKvncw7dfWVU1SLTcS+7vyonPUgRYRuqRU4L GGBNA4pAOtllJNOZts6xRfnLhSfhNVmLBOEi9/4AHDjj4F5wIHbYMB4s8QOv75LYW+lu3MuqV Qo5nh3wRaSrLPB2SDs6w== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The nfsd4_blocked_lock->nbl_time timestamp is recorded in jiffies, but then compared to a CLOCK_REALTIME timestamp later on, which makes no sense. For consistency with the other timestamps, change this to use a time_t. This is a change in behavior, which may cause regressions, but the current code is not sensible. On a system with CONFIG_HZ=1000, the 'time_after((unsigned long)nbl->nbl_time, (unsigned long)cutoff))' check is false for roughly the first 18 days of uptime and then true for the next 49 days. Fixes: 7919d0a27f1e ("nfsd: add a LRU list for blocked locks") Signed-off-by: Arnd Bergmann --- fs/nfsd/nfs4state.c | 2 +- fs/nfsd/state.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- 2.20.0 diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 1ea7a40f8d4e..551068f4b836 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -6544,7 +6544,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, } if (fl_flags & FL_SLEEP) { - nbl->nbl_time = jiffies; + nbl->nbl_time = get_seconds(); spin_lock(&nn->blocked_locks_lock); list_add_tail(&nbl->nbl_list, &lock_sop->lo_blocked); list_add_tail(&nbl->nbl_lru, &nn->blocked_locks_lru); diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index ce32ba445343..c1bb6a5ecf57 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h @@ -605,7 +605,7 @@ static inline bool nfsd4_stateid_generation_after(stateid_t *a, stateid_t *b) struct nfsd4_blocked_lock { struct list_head nbl_list; struct list_head nbl_lru; - unsigned long nbl_time; + time_t nbl_time; struct file_lock nbl_lock; struct knfsd_fh nbl_fh; struct nfsd4_callback nbl_cb;