From patchwork Fri Dec 13 14:10:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 181561 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp690771ile; Fri, 13 Dec 2019 06:11:10 -0800 (PST) X-Google-Smtp-Source: APXvYqytlqsRePfRnu8n2y53cTJiAVKAs8dVrRvdnUqYKgy979tkBfjWlU978AQtuD0UN1cSDNoa X-Received: by 2002:a05:6830:1d1:: with SMTP id r17mr15702747ota.151.1576246270023; Fri, 13 Dec 2019 06:11:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576246270; cv=none; d=google.com; s=arc-20160816; b=wH+ppKV8wAPmYPIy1BvfS3BSlomhAp+QJnLqWr3vJoOxy60duHqvqhTi8aV9fx147i Me6l1lORAzH4gin2YKkxFkfIr1wjOxwQ5QgyNur10qpeo75cPnXeKwU43H3KKZgyqIVJ Cm6hMvVNMbSPP24x5SWTeS5KQlWvphUUtdIh6KBlZj7lrR5zWh5DMd1hK15mQdInkbIE /VcpMJ6JDXKlwQrA/DSry+YJDFCwjjRLPPg+52F3oEsibe9mJi07VhnLhwXiKOW6zY2a B1CojFkLzKdUtEuTNCTKT85mFKkp8lXEIN5hGeWzYOt56+pzI4eieBiXtK0YqrEJeRkx f/Dg== 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=4bRU70Yt8f40X6BC4j8AUrPw0zfAfr/V2zXdCoFBO84=; b=uzr7eys04D05U+gPpCpbUZmhbxTgk4uCYM730hTIQ6DSN05RKWf08Xz6MXIMY/653K MjY7FuEc1N+IVJuZXgocP/V/0Lo91ekmMfR7HVakiFPi0JuOqRNZExFkUeeaXpt2KD/v vQ4J2A7ZCkfNZtuOKFsr3+4p0p/l3hc0gQrLcKT3si8ihpAoqtirndtKcoWuCeGTUuw/ TPTG2PWBOB/VYnAyX3L/KXRQXSM8mCS2nT7FFG6pqiMHWnbQMz1Age3Vep3um2ldEl9Z QWdhnlluH0FSo/lz0ctiqDrFxhtfw9uh+EnncERuPqKXl2IY+W7id+QLzHR35aDAb8s5 N9Hg== 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 z14si5068756oth.15.2019.12.13.06.11.08; Fri, 13 Dec 2019 06:11:10 -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 S1727720AbfLMOLH (ORCPT + 27 others); Fri, 13 Dec 2019 09:11:07 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:45803 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727595AbfLMOLD (ORCPT ); Fri, 13 Dec 2019 09:11:03 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.129]) with ESMTPA (Nemesis) id 1MO9qz-1iLjfE1Is5-00OVdn; Fri, 13 Dec 2019 15:10:57 +0100 From: Arnd Bergmann To: "J. Bruce Fields" , Chuck Lever Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, y2038@lists.linaro.org, Arnd Bergmann Subject: [PATCH v2 09/12] nfsd: fix jiffies/time_t mixup in LRU list Date: Fri, 13 Dec 2019 15:10:43 +0100 Message-Id: <20191213141046.1770441-10-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191213141046.1770441-1-arnd@arndb.de> References: <20191213141046.1770441-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:RFuOm2jAOCBiUoXlcDVvCUpmtQ/EOsE27v8hWd2SPEDQBW1MVji F20sBMDqnoDPPoQR3UwHCy/qExcLtPGSC0zhgPPoacYANfEO0BM+cFNtUO39R+nniEFCvBZ 0vLjHqwoptxwnSOyc8O+ofFbLlZuGdwVfar9RmTj5Jqr9NXtOr7H0ORBwlnxhkqpm+i5vBc V2a+eqY0MgrkZ3mjf4+Zg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:/UJVsafxFSg=:Y4ga6FSx7qvpwzE042pdFW nHzm568/bjSOtNM3soyeFV02GfMcErPlxHw0/MfcTiKPwvjl2kkgspCHFVFXg+7/Je1S/H4mM rPYIKoouGVczC+4S56Et4qsP8WXxfzlipZ4SJkiELqDl6eb6+El8v1Uko5qek/npGIRsdSnt6 IrHYw1AinWZMoGf/rDw6Ngnu5CYJTeApgfuwA5wEiLDDzuZuptGI3ILthuJpWbxaTfqKtl9kC LTh45DFhs/FM0dtsQhevr8V9rGrplekeI1/Qc33aRGHbd8s3ecyUaHjEMNtR6aed9ob9GQunC y1w9XFb3DBEDfcEFqgLdy8AVRMxStRgS2I3fzDILpo5BeDEyhXDZo+XFu1dfcbATh66+DTC4t k3I8XEAeiibrm7GHdwxMYrGAKjb6wjkLX2WswG+US/bJWrq+WdBZgWcMXbu9mHUjaHCa5+mf9 bPYQiSYIEr3VQr4G9qSXjWY1el9D8qTAti3zaV2Io3t44t0RbLFGL36NWieKADpKha6fv7aia l94qnerKOBVrbZRX8dfHxTIhMcmLwTitNJnt/0bqniD/dPddUefOzvhwPrKKBzOy73G/6Gf8W xK5+NwoNua0R4f0uh5LAVA7EgUeAFgej6hdX8xuwqSQ6lxH6Amy5BpS8vNjJbsFYByG0Noii2 VniQCnoU/q+bnfa6qV4t0mOJ4neo1rxcaJgpheb51U2Gml0pmw+2w3e2YdMQvxP9F8zj6IquR CKZFWDn2aUFJPcDu9GfN0yZn2sXyVqFyuGgCBILMFwyOJhltZ18h+ANJxR34iIplBFk96ZV1z lsvol/QnE9t88BLt/vNZmiBEXFG9BSTw0kfgL5TNdRSza69lkUOqjZTql50g4+qCjpm2o5TH3 1YrHNuuBy5tUvhDoJYuA== 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 5cb0f774218a..9a063c4b4460 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -6549,7 +6549,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 2b4165cd1d3e..03fc7b4380f9 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h @@ -606,7 +606,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;