From patchwork Fri Dec 13 14:10:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 181560 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp690661ile; Fri, 13 Dec 2019 06:11:06 -0800 (PST) X-Google-Smtp-Source: APXvYqzqQcD2qrOI4XRVL9ZvaBGjBrkKfYKFszKAOjmveeaKMrziPd2Rfp6lC908YNb8hVb7pS4L X-Received: by 2002:a05:6830:1607:: with SMTP id g7mr14932319otr.320.1576246266021; Fri, 13 Dec 2019 06:11:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576246266; cv=none; d=google.com; s=arc-20160816; b=MvTPu+C+P1c2/GaBml4EB7y9+5x79U74yaal4Q6Kb8KSfWlzv1QRPDysXYalDCOlHH mloMKVBsD9wWxHih8yZ6rNR3QvrKyJuyIS569qDanCcTaOt0s8TXqMrxzZOurYJh56OZ Xx6adKI0QSHUtu2mod1f2palXmtBFW1nR5rnnb/YmeCA+jmVMLNnYrdmKTycUn31FAKh vlCyY/Nz1TARB7XcEs4Oru6THuNcwsU9PhWpfVKt9teHJwGjVGhFw9HA9Z3ptiTdwLNA mQ60Yev8bzt7vBMRhNEqbjdvEC2IOmZY7C6NgLVuG9VHTnmgJp1lSw6bc/7Yv9iILAzG 1WeQ== 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=ddeyJTgq1uBZs1eDlWkTEsGk/UKfp9HYWpXM5D+fyzQ=; b=T0qwIDmLhJFF2zWic4qvH8d7g8mkE6HCq0vz7ncprBwewxhd86DRy6t0m8lFf461OS uWDuSrtd/EDA8S64zXKbWKMl1h5iyadeubbyFFRQLDiVMkLx1RGBL5iXs5h10PJY38xm ep49Hn+dqsof4D6sB42FrUgiJs2/btOyLLg6EaCIffkKyf/cpmW5AiatXb48eaEPWLB1 FqHyyzkmBroSL/xchKohQLDchjzQ0gdKgP7KDQQSnjevNYiAfTASzdN/k4YxIzOilct0 k4NloVsFXoZr0J/FngejzFCaNFSNTvtE/lMireBPTgekJ/bIWTc3gs2vdoiC36YEFxoP F31A== 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.05; Fri, 13 Dec 2019 06:11:06 -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 S1727663AbfLMOLD (ORCPT + 27 others); Fri, 13 Dec 2019 09:11:03 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:51747 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727507AbfLMOLC (ORCPT ); Fri, 13 Dec 2019 09:11:02 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.129]) with ESMTPA (Nemesis) id 1Macaw-1i84Sj1p7K-00cCpo; Fri, 13 Dec 2019 15:10:55 +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 01/12] nfsd: use ktime_get_seconds() for timestamps Date: Fri, 13 Dec 2019 15:10:35 +0100 Message-Id: <20191213141046.1770441-2-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:UIf61Zh2SX1jsmuKNONn62q4e8CIE4uEXBXf6f109VVpmdYXULw 3DDB1afIxbPSigzPGj4zKy84ctp9G2LWRCnmiNkIqoV6z5Zbzp4ZaEjYXMvt/KdlcGScd85 CvkPLmDDRNSKusXQV1jFQnVyNcrmpdXyPhhO1iLZNoX7r3RHZmLXwh42dFUClt6jlfW3gB+ 5LDOGbPnVIvJ/6UhqWWXg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:Hp6SY27GsDo=:roxwhEgFNjaSqv9qD56rYs aKJi8HwFgh2nqNbgz5XSZIExntsuKjtyQV+V3MTihNeQCpjp7o6Q3uLQlU4QxgXUoQlzEH6Hl xdCdnZbd6z/CSE+NEA1fax+01ClDVcAVCX2KK/ITYYl9A22DQsZTooCPJ5uURpq6nVgYjoT5T oWamxoH9qYQKdMoX0Gb8/LL/HbEot/xISWlkhaK2D5AmUTmpdrHL1MPp9bnFgL/P2JgNzzGRN R+6Fy7d5axn77UC/DPyufnXcDXljXR+GSe28AmWxFbvZZwmNY3WP23O0FmEP4M2+kj4hx5jhn O0e38IzmBWN492S5t5jfyRSWQk7Uaj9lbYh2tOPK+q1i5aFHAY2clTtEFY+798kvSkuCvzOy0 DayV7c8o2tLzxKV7Sko6HAZ6EHE9kIJJwnT6tnPPLA7Mtza873EHnIFrHBDJ4UD49vTpNUCNS rFbLRdo9u4N+xk3PImvMw/5WzjFV1ejMQ3OqSboFF6SLl+9v0fIu9yH433WDyxX61flR5hsr2 iz4TIaLPctcgTKC7nSiENvssIXEGbbRsC6StTNtwNC7Q39A2WZJwm6Nt2kn+HpkFbvBZnWGEN F0apOSYVE6Aib+6kx+2vTl8k7Go7hmQYhvDs3KZLsCV60i3BmykzAMGPUDzN65IM9jYu9djxb h+m0PpeJTeQqIo8i5m1U0f8hsuiIyrMjU3JLsDz40z81LL1dt8Ena7vorRoWKTbTU4Li9Eu7o aKqSlY6f5QnHdMiFro7PsgvqmvyzgSRz2q9EVhC0AJbZ+acBeieEWf0XIkp7eiayxYPK89mbr L9LP0NJAi0/Spg0XZCgRYgCCk8KjPO1ovkUILkg41wtdDR47/EuSvphRALTvCMQgPUDbINiHZ v8K4a5MueHJWbKn6X0kg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The delegation logic in nfsd uses the somewhat inefficient seconds_since_boot() function to record time intervals. Signed-off-by: Arnd Bergmann --- fs/nfsd/nfs4state.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.20.0 diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 369e574c5092..bfdb3366239c 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -806,7 +806,7 @@ static void nfs4_free_deleg(struct nfs4_stid *stid) static DEFINE_SPINLOCK(blocked_delegations_lock); static struct bloom_pair { int entries, old_entries; - time_t swap_time; + time64_t swap_time; int new; /* index into 'set' */ DECLARE_BITMAP(set[2], 256); } blocked_delegations; @@ -818,15 +818,15 @@ static int delegation_blocked(struct knfsd_fh *fh) if (bd->entries == 0) return 0; - if (seconds_since_boot() - bd->swap_time > 30) { + if (ktime_get_seconds() - bd->swap_time > 30) { spin_lock(&blocked_delegations_lock); - if (seconds_since_boot() - bd->swap_time > 30) { + if (ktime_get_seconds() - bd->swap_time > 30) { bd->entries -= bd->old_entries; bd->old_entries = bd->entries; memset(bd->set[bd->new], 0, sizeof(bd->set[0])); bd->new = 1-bd->new; - bd->swap_time = seconds_since_boot(); + bd->swap_time = ktime_get_seconds(); } spin_unlock(&blocked_delegations_lock); } @@ -856,7 +856,7 @@ static void block_delegations(struct knfsd_fh *fh) __set_bit((hash>>8)&255, bd->set[bd->new]); __set_bit((hash>>16)&255, bd->set[bd->new]); if (bd->entries == 0) - bd->swap_time = seconds_since_boot(); + bd->swap_time = ktime_get_seconds(); bd->entries += 1; spin_unlock(&blocked_delegations_lock); } From patchwork Fri Dec 13 14:10: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: 181564 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp691055ile; Fri, 13 Dec 2019 06:11:24 -0800 (PST) X-Google-Smtp-Source: APXvYqxb7vIrOT/8kb7/ZgBiL9HA3/no6DgvzQG2fAY4VBy1ObVi3BkxgpOraL0n1xofRqZSjKEP X-Received: by 2002:a05:6830:2087:: with SMTP id y7mr14090068otq.96.1576246284256; Fri, 13 Dec 2019 06:11:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576246284; cv=none; d=google.com; s=arc-20160816; b=Hmgrhldse2spcJu5uwDPubFQt1OMOuNSt2LEgkpyFlzKzwrwk1NBR1AJW0KFeP2+a6 9wcw+prB8VAwfDz2S8c2CIMzPPqUI4+O0pZWi6imXDYVh0R9qImg1ubu24/L+76UD2aX zhg7H74WaZdlSNjpozGbal/fI2IokZ/G6NET6DvJvDEHIzOdI1TVyQftHHBDrfaRTknl PB6qUDku3+Z2mHVbaiHaTkGWOZItyI2Zmriqv3f/VRo3f7DPSgCb76Vb7cbL5O2QCk95 oG6dkNWH9dJMYGRdjpz+lp3/VLFbXWyXsbKAABOwzIlnHMu+8Vz7QQiiEpiGSUmjuNo0 /aLQ== 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=cZownGuawblGHwkUgbaAuD4wDR82JaWl4hpRFjxGM84=; b=jMl1Km8ydlGWuKDb/1btIFIY9nZtdgUiUPxOVhHC4nYzn2nruO1F/ENLL+7uDeUT3D Hcng81OB+l1GeSRJSzG8sxjZYoc2YYLv9rR8CvYr/ZgVLBb9HhcNBfqqSW5+Nlp269Wj wLrVDJHGD8Y/x0bYcJRFukK7ulLsrh3pSyv6Z43Jjp+kBDvMMdTvjjfed7CjjIOigkzO hEhXziZd0xmGO6aIw/0Q3Qusab8iFykyvWd7Wzg8KNRtc/kRET4OhOrZPJFMX+ArTE2/ 2McE6YtJAnoXtDkpzZYE8Hlw8Go1/FSTui0RlsuzJyK0N1hr561m841PsB/o7gu7gEQs tYug== 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 l26si5250259oti.152.2019.12.13.06.11.21; Fri, 13 Dec 2019 06:11:24 -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 S1727697AbfLMOLD (ORCPT + 27 others); Fri, 13 Dec 2019 09:11:03 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:45377 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727444AbfLMOLC (ORCPT ); Fri, 13 Dec 2019 09:11:02 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.129]) with ESMTPA (Nemesis) id 1MAwPZ-1iYuxC2l69-00BMTf; Fri, 13 Dec 2019 15:10:55 +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 02/12] nfsd: print 64-bit timestamps in client_info_show Date: Fri, 13 Dec 2019 15:10:36 +0100 Message-Id: <20191213141046.1770441-3-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:9SKRS2jmAK5+hO6gAt+vF42FOBN1KpKLDxwzePH1lowj6foByry CIqvaRNhyDSGJgY3FraE0vEHhTpHpKrfa5lHsX29Shlb19GnvHhdffNyJS9o65dK9xFXSJr VKgO8AZg+Kqw+0tZkdVajeAJdnfFut49Q4DZ37HCEbXLwKg+6rqPXt1x3sWo/ARw4hOVUmd faFRZtD73I0oGQl1pWE5A== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:HeR70z0Cop8=:StWF7PVMsAoCw2qyISGuhu dNC8WNZENQ17lNI7XUyUGADy6d+lWRK155FM3ImDhMxQFl2nBjLZaz162IzL9C5BHKUDjw0/T rUKeBzoUb7w37fiK+9Sm74zlZUb6BZEQGrUha0fBw0DuIwvOrnyVcrfQSpfaleBw31MANU0pn q31FBoAyCfPDL3VLNgX1L9n2ERQEUtEFOUy4B2eaWoMPOtPChMM6rL5nrJ9pKKR8uq4/7xaaS Y8MZJ6f8xP3ZVvkVHlv1Obvoc8gzGGIH2NAlEkcCQigu4TCOcjl04VrcUYY9mgx6tzZ77oOf1 xTLEw+Uq2f2r2woveSUrNj4rin5VeKQecXorR/RlsaPUI4bl6VDdu9dO2K/+Id5ysiMg0Q6+p 2Goyo6sSRBYmz42XtoQEQeHdgZa+vQtmkX+lpDIW4hXMfsIM74RkoArDBZc27A90Vpmk9VlB8 QyPec46dZyYO0jecL26YhuYIfr24WZIMwCm2Hjb2RdDtNqVqUuAhxgGqC4pK7IzyU/0rrbiNU rcFAA1nfLt8KSt3rllpNwcaMLkX4eu0hcr673dbNv1X5KUVeeHshvdxxD78G8ikyD3rEk7qI7 eKgj+gbm1dDXQmCVAUy+75xpatHG5DGjd6nl/vcA8eIoesPToBAiM6WfP4lTTccKeZ5aSsVvp yI3P1RG9uKU332bbRHWfNgR6YOr8DD+N8p2Y+j+6V6HS4z8yES0d5oh/cfXJQ95762peAnpAe YLZqgjREekQECvmx1HBR+8BYfFf8gdFCBC5HX55pMG0efBAiFQ6u+qFiht8/ETmkoEF3GYkB4 azWS5rk+p1lYbE33IxJxVgH4p/A9A8oOSiSmJA5mjJqW2kHaOEOS8n909p20y6/tArVaFkqDm +D+kjTJ0zwlmcGvnIzxg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The nii_time field gets truncated to 'time_t' on 32-bit architectures before printing. Remove the use of 'struct timespec' to product the correct output beyond 2038. Signed-off-by: Arnd Bergmann --- fs/nfsd/nfs4state.c | 5 ++--- fs/nfsd/state.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) -- 2.20.0 diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index bfdb3366239c..27a629cc5a46 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -2292,7 +2292,7 @@ static int client_info_show(struct seq_file *m, void *v) clp->cl_nii_domain.len); seq_printf(m, "\nImplementation name: "); seq_quote_mem(m, clp->cl_nii_name.data, clp->cl_nii_name.len); - seq_printf(m, "\nImplementation time: [%ld, %ld]\n", + seq_printf(m, "\nImplementation time: [%lld, %ld]\n", clp->cl_nii_time.tv_sec, clp->cl_nii_time.tv_nsec); } drop_client(clp); @@ -2946,8 +2946,7 @@ static __be32 copy_impl_id(struct nfs4_client *clp, xdr_netobj_dup(&clp->cl_nii_name, &exid->nii_name, GFP_KERNEL); if (!clp->cl_nii_name.data) return nfserr_jukebox; - clp->cl_nii_time.tv_sec = exid->nii_time.tv_sec; - clp->cl_nii_time.tv_nsec = exid->nii_time.tv_nsec; + clp->cl_nii_time = exid->nii_time; return 0; } diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index d61b83b9654c..2b4165cd1d3e 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h @@ -320,7 +320,7 @@ struct nfs4_client { /* NFSv4.1 client implementation id: */ struct xdr_netobj cl_nii_domain; struct xdr_netobj cl_nii_name; - struct timespec cl_nii_time; + struct timespec64 cl_nii_time; /* for v4.0 and v4.1 callbacks: */ struct nfs4_cb_conn cl_cb_conn; From patchwork Fri Dec 13 14:10:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 181570 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp691513ile; Fri, 13 Dec 2019 06:11:45 -0800 (PST) X-Google-Smtp-Source: APXvYqy2b35uHU2pwjiARgm2jHW6VUMC+Nga1yBoNGfMwOPWGq27O5gI4sxeH/QWa+gyLj3L6Xob X-Received: by 2002:a05:6830:154c:: with SMTP id l12mr14809930otp.275.1576246305296; Fri, 13 Dec 2019 06:11:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576246305; cv=none; d=google.com; s=arc-20160816; b=G0dqg/cvXLKTCIHVDqzXEHlqmcl7EIaOwTYAwYbg5Tpqi8PO8yD0Ms5Tw7dmVtxi1Y ge8WtLE951yISDDSjXDblAoeqX/s/cP8v/ukV7zpSbZRrxjExbzz0JzmXjCWo8DFchvM wrgT5Gqbm3jepXFpXloI2ZW4bHH9ECJN4QScSyO7LpjXt9G3kyjMxzeIWf9OkbPOfb2y c5dM2mrBg69M3gJtlIQMtaUDkgH/lL7QDeZa1iibRwFAKSHnnSOueOjM50uWp9mU/qB+ vM5LY3V0fA9ISwApuTKPFykarkO1B13SEeWycFVszaFAJE3hT5S3pXCNjsFFI06CP24l ZPHQ== 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=yCkOUOxe/xOr/m6eSZ/KCRrd05m6b6n9pwvS8zWyVIQ=; b=l8su1RRFSPBAs1V161+D7cZZQuB7DfYTUYABZ/deSQUiFavFXWujcFTNxeGf0CkemH lZBldCd1drPnLd0SZgBUnLe7IZNiOBudwcb+0MZUX/D6EW/WnmXLWkiAo3BkHWeuEFM4 RR9regK5owtu02sC6hikiG7G8mGLQ88guYUTY6cYeFgsS0Tvybjau7CUB6Zu9GhuO93q 4YGOna0ifwcwTsx8bxIyZH2MKadQ02Jo7D5EgAuaxrkYa3V+4KAKKocfTZQLw++gVsT+ 7t4VLn3NqFIHnZD1eOW1iB/cDXHS4nAjKJTwMGqkfHyqWI6KIjkqohkSfRg4QQP/3zEA 3svg== 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 f16si5135005otp.198.2019.12.13.06.11.44; Fri, 13 Dec 2019 06:11:45 -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 S1727823AbfLMOLn (ORCPT + 27 others); Fri, 13 Dec 2019 09:11:43 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:34193 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727572AbfLMOLC (ORCPT ); Fri, 13 Dec 2019 09:11:02 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.129]) with ESMTPA (Nemesis) id 1MmU9R-1hxOHO3fnt-00iVR1; Fri, 13 Dec 2019 15:10:55 +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 03/12] nfsd: handle nfs3 timestamps as unsigned Date: Fri, 13 Dec 2019 15:10:37 +0100 Message-Id: <20191213141046.1770441-4-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:RAcT70BOi6dHmwI2QhfGxwpnEjl8Xen3AOmqf/6IFLp0gdD9yWG Dbi2Qqva4OJzNwTnQLnAgcWSZU801l9DwallJOmJl3lDQ6NmPxR+lV7AVfgGufQ0qEVmJYU jwat9CZOl8PYNTLoJcKZ4H4ycr4wHjknk4DhfVY+Bo3NKExWjUhxgM8r8ID3OgmwyW/U09a W1bZYKmA0QU0wXeH5mDVA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:F9gWEdFUl9Y=:AuUrT6ZxwheXz9gbaX9nA8 VBcgqdx4pgeuvh4BQK+JdUncPkMUcsR8Zj2wlNwLPAqgeIo/BFVJaIHrej3X6/CahQVYJEbtc 5ueNY7LVZY2/m5h7FnDwTds4sxJ5iHe6CIq3WOXsHscPZRZdlnjL98GXK32bdiM/4pV4B+1s6 WaN2XhYi7aTHKeYMXIjOFXjdRSOxAHgHJrjnyJ1Ssp2kX5Hhsy7QaA/Uv2Pu9neunPqVaoluD mJwrSoPJfYoIMzZbXCogbym/Qvuz3RS59chkxciH0kYAlrbHaZ1HLtsbJfD428bppcMkI/yL3 cuy7hX60DPQyGxYGBFHuOOSLJ8TXXvmoTGO+3T+Qku2teQlXKD6vV6ylPdx3FEkXNKB19RYXh 0bilZ7qRptJk2DG5bEV+QGye+tE0UJuG+37lNCgf5wT126Yh83yKj8V3R5g5ppRgz8f0iQbpb D5sIDNRhwr0h+Vh5H5iXVFo5lNU+K0mq40CEDXVV/T0M9hLlb7qUIKTOkkFdkRy2KMZepyrrU qVNi6pHe7oVZ3GePPAs8YLWGrDKmzAlMK0MgwQCRU06bvHBP9ukD4oRGDsccxtfqWuggRZJyE /Rxu7iEqoIuGFTEp4HwVwIoNOr3S32RXWbMTdfZgwgu6IfZ4yuPSUboNi2QWqlfZWc4Oc55uK r6K9TbLIwAORI28te5SuvJNlsT+mBDmGyci3DJVNfNImgKdegYW9/BTQj9Dd/npqKudl8xf8R I/v7yXERCFOg6ZOrjUoZjY9m531Il+o6AgLlNDqPWY6KFH11tSH9m+Rr79+UB6gFDn5JdkotO DfWtpEstSEUJ/4odyAAgbNlNPhpAfczvJjyaRKrG/Mw7qKr3g9k1i9XtVfykbiIzVU765X3ii VWIlLF7vHM26p4ZOWooA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The decode_time3 function behaves differently on 32-bit and 64-bit architectures: on the former, a 32-bit timestamp gets converted into an signed number and then into a timestamp between 1902 and 2038, while on the latter it is interpreted as unsigned in the range 1970-2106. Change all the remaining 'timespec' in nfsd to 'timespec64' to make the behavior the same, and use the current interpretation of the dominant 64-bit architectures. Signed-off-by: Arnd Bergmann --- fs/nfsd/nfs3xdr.c | 20 ++++++++------------ fs/nfsd/nfsfh.h | 4 ++-- 2 files changed, 10 insertions(+), 14 deletions(-) -- 2.20.0 diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c index 195ab7a0fc89..c997b710af27 100644 --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c @@ -32,14 +32,14 @@ static u32 nfs3_ftypes[] = { * XDR functions for basic NFS types */ static __be32 * -encode_time3(__be32 *p, struct timespec *time) +encode_time3(__be32 *p, struct timespec64 *time) { *p++ = htonl((u32) time->tv_sec); *p++ = htonl(time->tv_nsec); return p; } static __be32 * -decode_time3(__be32 *p, struct timespec *time) +decode_time3(__be32 *p, struct timespec64 *time) { time->tv_sec = ntohl(*p++); time->tv_nsec = ntohl(*p++); @@ -167,7 +167,6 @@ encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, struct kstat *stat) { struct user_namespace *userns = nfsd_user_namespace(rqstp); - struct timespec ts; *p++ = htonl(nfs3_ftypes[(stat->mode & S_IFMT) >> 12]); *p++ = htonl((u32) (stat->mode & S_IALLUGO)); *p++ = htonl((u32) stat->nlink); @@ -183,12 +182,9 @@ encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, *p++ = htonl((u32) MINOR(stat->rdev)); p = encode_fsid(p, fhp); p = xdr_encode_hyper(p, stat->ino); - ts = timespec64_to_timespec(stat->atime); - p = encode_time3(p, &ts); - ts = timespec64_to_timespec(stat->mtime); - p = encode_time3(p, &ts); - ts = timespec64_to_timespec(stat->ctime); - p = encode_time3(p, &ts); + p = encode_time3(p, &stat->atime); + p = encode_time3(p, &stat->mtime); + p = encode_time3(p, &stat->ctime); return p; } @@ -277,8 +273,8 @@ void fill_pre_wcc(struct svc_fh *fhp) stat.size = inode->i_size; } - fhp->fh_pre_mtime = timespec64_to_timespec(stat.mtime); - fhp->fh_pre_ctime = timespec64_to_timespec(stat.ctime); + fhp->fh_pre_mtime = stat.mtime; + fhp->fh_pre_ctime = stat.ctime; fhp->fh_pre_size = stat.size; fhp->fh_pre_change = nfsd4_change_attribute(&stat, inode); fhp->fh_pre_saved = true; @@ -330,7 +326,7 @@ nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p) p = decode_sattr3(p, &args->attrs, nfsd_user_namespace(rqstp)); if ((args->check_guard = ntohl(*p++)) != 0) { - struct timespec time; + struct timespec64 time; p = decode_time3(p, &time); args->guardtime = time.tv_sec; } diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h index 755e256a9103..495540a248a1 100644 --- a/fs/nfsd/nfsfh.h +++ b/fs/nfsd/nfsfh.h @@ -42,8 +42,8 @@ typedef struct svc_fh { /* Pre-op attributes saved during fh_lock */ __u64 fh_pre_size; /* size before operation */ - struct timespec fh_pre_mtime; /* mtime before oper */ - struct timespec fh_pre_ctime; /* ctime before oper */ + struct timespec64 fh_pre_mtime; /* mtime before oper */ + struct timespec64 fh_pre_ctime; /* ctime before oper */ /* * pre-op nfsv4 change attr: note must check IS_I_VERSION(inode) * to find out if it is valid. From patchwork Fri Dec 13 14:10:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 181571 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp691611ile; Fri, 13 Dec 2019 06:11:49 -0800 (PST) X-Google-Smtp-Source: APXvYqwoxaLB/vksdk6tubVHsEelYeRU8aGSoUVeIeeyZhI6zpOioVfozEnZY2v7ylWFA7lmsRC7 X-Received: by 2002:a9d:578a:: with SMTP id q10mr14329538oth.215.1576246309743; Fri, 13 Dec 2019 06:11:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576246309; cv=none; d=google.com; s=arc-20160816; b=TrKRnhabjkfILZAGTYomocpcPRJhILAim5ooqSmWbQgv3+YdkhMReDVbUa9OxJN3Yr n4KM0R4itim4oNX/tEUUj5QW41SfL9d8Z/HjroWgqfkMybleH378ohbcSpfWl+ij+kaY aBth8/Uim4TafURUD4JKQZxUrg4CGof9A6WS/JXuLPYG5TJHByfBw45GsSgKOkB1AeaA a2Hg1R1ETZKl32MiCIDRHVtmFjqTW8OV7mPti772iQYvU5vUHyEhgd1f8+qIISAfH1Xa sulqsHFZF7oAMB0tPyk3B7gyK7DHVSqCTERhxd81ipx1qXpvcRgxzWd+1ln2JDYezA0v 0n8A== 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=wXb1iUCc54S5BJfWgNavW1TKOmf0jp4QewjiU6wEiF8=; b=wSjLLREglOPE9DCfrcJSAe8TzRe+a18EuWUtzZIuElSVVKWfkHfVavI8IruDiySf/P hNqsyx2BbbljbQLzS/5A9MzEFp8e1PTBfrU+ThaAAM5w3XPUpRlYqkRiTpBReNnyPJQ4 MuHh14aaZZGvP7iuxweKASjFa7hgv29S6T+5kd2VZYsq8SJQn5CXkZeYpoERAPZSSizr 4qyl9KOExlstMmQwSQovmrnJnCAEV0uGxB1i6EuuiCu3ug7gjkqDzhG14f6RtsmVS+md XkDKisEeZowM/xCXHpGs6gorqd+pRMde/5nlk5+clphE55kjfOd245t5OzFWIyhewcrh oL3w== 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 f16si5135005otp.198.2019.12.13.06.11.49; Fri, 13 Dec 2019 06:11:49 -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 S1727834AbfLMOLs (ORCPT + 27 others); Fri, 13 Dec 2019 09:11:48 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:53621 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727563AbfLMOLC (ORCPT ); Fri, 13 Dec 2019 09:11:02 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.129]) with ESMTPA (Nemesis) id 1MDyoW-1iY6g00PeG-00A05y; Fri, 13 Dec 2019 15:10:56 +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 04/12] nfsd: use timespec64 in encode_time_delta Date: Fri, 13 Dec 2019 15:10:38 +0100 Message-Id: <20191213141046.1770441-5-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:tZvyC8/MQsSdMybbn7ZBclcwu9BJ9OSnv+w2Y49XsSD5Al3PHeV 1BpQWJ8CTGqYOrtPofdSkjDSiAe1FTqlMslMMcslfrQVwZo0TJcZsjeoV0vOa4OfOMwU94z cpb4m99r8/SDq4g1TmCXRfhgN390wAf1G4f9P8sD559qT2taHWbpzKYkBd/SYTQnMD1KmaK OUpuH4MSQDemrLltAdLrA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:AdmRwze8Z4E=:xF4d1Q1zbssKpYCKrZAehX iOa2n27bjHhFhK+1X3q2tJsP23OQKx+mtiNF0JzO63D5wzhzioYCobJkMXY75MXI1p4YpauX/ 91nixKEqpV3FK7U9yX9/Ve4UVdTp/3UKEyVb0J1l4ctNmsQ+MtIlS8p0WCGPxfkcQKdATaqqQ b5rzmP2ZuOozb52J2ySXyLl9GjHDAUWiTUwvJOqkK8eSMZXnNJ/seuwJXVMejhHasDdSiIUse wWkn9pIyAUQsOE5WxOE8SU5Q3SA5XCM2O+7hWIJUHWvsCvylPAZCNeFpq1IsENaXZB4kjx5su NuKATCHd4a9EtwWD74lkt4PPPsUgfI1tOaT8N7dwQH6Qo2IPi63dJQHQLmT5luY4En7SmwP41 W/vuVXK7zg3VWzGXk5e3OPpw1W0A1+bhygoX6f2+OgUMcd9L6qILvXmYsxjyO2aOC6Txg1J0r KmEz2asupLeds71AnKt0VuxFlj4JEN7EtFwdPj8qzD+NOEzWb2V0NijcKf0TJk3dELj3HgGtF nqefQE1umqOWr9WyPFNtgaugDhj4Xe0TYvrMb4CejcV86cXc6B9I5dDNJQVb4wIIcYmBRBNJD z6M88crsThjQ/VzH5avisyxpG+HzRYYDIe3sb9YMIX0/dxGnB70sDA9FBlMeNtZ/VCd3sNJJh aKHIT4xmXNN8idc4pUoUrYk3PWcVByde3cR0i6K5lRpZzlFAA7V0RnSS/3PNRS/+oGiPMG1w1 A3L2HPVvXNwsUOMUmASY9x8O+O03OZGvDb3TmVOcjjeIOt7td2Zaolo9hn0PDkEknveBBW9zW AmRorA3LJfohba9VLRYd4NtsIFb6+yQecHEynYIXb1jKfa1CRBot2ykyVdzlrGHhjwJPJXeIy vH3EdYL4Sl644kr5PE+A== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The values in encode_time_delta are always small and don't overflow the range of 'struct timespec', so changing it has no effect. Change it to timespec64 as a prerequisite for removing the timespec definition later. Signed-off-by: Arnd Bergmann --- fs/nfsd/nfs4xdr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.20.0 diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index d2dc4c0e22e8..d95e9668eeff 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -2024,11 +2024,11 @@ static __be32 *encode_change(__be32 *p, struct kstat *stat, struct inode *inode, */ static __be32 *encode_time_delta(__be32 *p, struct inode *inode) { - struct timespec ts; + struct timespec64 ts; u32 ns; ns = max_t(u32, NSEC_PER_SEC/HZ, inode->i_sb->s_time_gran); - ts = ns_to_timespec(ns); + ts = ns_to_timespec64(ns); p = xdr_encode_hyper(p, ts.tv_sec); *p++ = cpu_to_be32(ts.tv_nsec); From patchwork Fri Dec 13 14:10:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 181568 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp691374ile; Fri, 13 Dec 2019 06:11:37 -0800 (PST) X-Google-Smtp-Source: APXvYqzUI6LU2m8Pcn8560wfu5TG9qav2IK65NuEGeFsNzyD0viJ+LXRRbXqCgBdycb3e9eN/7ai X-Received: by 2002:a9d:684e:: with SMTP id c14mr15032296oto.340.1576246297167; Fri, 13 Dec 2019 06:11:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576246297; cv=none; d=google.com; s=arc-20160816; b=VBrYO4vSG3/3p3o4lt2VmHaM+pnUSJy2qoh2J768TZJhgfKd9MUwNMC3OP/KtnLxvF REUaplubb9pgG5Do3DpEWEhyFBWvXFiVQitYhdg7nXig3E6VOoqe1wNO188WZkqLgwHT Wze6NStqmuLuBr2WiOPl+dBvL0cW+RPYHlBeDTqy36tLRjVbWlKXYZU9D6mVJG08bqTq QKA+9fGEMwVRxgw+sasovxI/AStUzvRICC0H9rn6qllRWFBGa4i4KFZXxfgy6cqj/ZA/ 1hSpWPUiIuZBKgr42fFFCdKcopqUqLai6bh0sVuWa1MZApeGzg3ZYyxm7L2QZFnlhU9R +q6w== 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=p2mHwoqPMumGuZfkCpMqPTyeCU9CqB1D2LnCPxwtnPk=; b=iiE3QZua5Y94Z5twAI70IppTSfx3d2ZMXjBfs/WH/6OxeP+KJJ6CtgsR6vSCsWYm+7 feWbuVMOsjV1laCKfuixzTgVWVGwVo7SCgB5UD927Af3DVAXOfEvN9mSueU38i7S1mTB do7+MldRUvBkKP6SztvB6JkNtHJgWoLFkxnwycll3AH5bWGd1NP6cO2nRHdXLrsHzy/l lIb+ke4k94Pz+qI70wqsvigGSwZ3J4WLTZYcK86w0oPKSfal/rW423ToBzkH6gb9dTl5 dbKnyUa+N7qvzX9KASJ1u4VSkaWVBbCGwhg6th48X36uPdJOzmmnUQyk1kYG3/NMlLku 7AFA== 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 a20si5383632otf.271.2019.12.13.06.11.36; Fri, 13 Dec 2019 06:11:37 -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 S1727787AbfLMOLb (ORCPT + 27 others); Fri, 13 Dec 2019 09:11:31 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:57525 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727559AbfLMOLD (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 1MFbeI-1iVKSE1XmY-00H7do; Fri, 13 Dec 2019 15:10:56 +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 05/12] nfsd: make 'boot_time' 64-bit wide Date: Fri, 13 Dec 2019 15:10:39 +0100 Message-Id: <20191213141046.1770441-6-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:ulRRllI5JAoz0buK11S43JXVc/eMQFrIawurypLyW+N7TiEk0dp sYPiQy6yvK8EGQIpnFN2TTwvGPPXkdo/AQIl7S/SrZCuD2WGshTS2C4G8EUX49W4DwNDUtD L88/4+GwzL6UsguMBy6RERpwuy6IQumqGgXy6L+iDb2UHPXPwa2X8rChSWR1KTjzHVNkC34 OvnVT8pX39Yg9x925DqbA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:NcumhT8wISM=:JBOSCdGfsCAdWOIW+bnrHA QA4UJlzwE2vocoKnX7UialKPo/que+qGW7+EHoXxQ3MzakMVSf3MRYQW+Zlmh0kCKxlHkkV7d Hsewp+K2GVG9yoCqQEdlG0WETcBZNX16d1xB/y/0Y8/2AJc03sSMK7pkikjEkHmIbHitedOJQ EKABeWyDYp2cY+0uZLzplYYk/1tD3AnlejEyRaRqXOxLorSlGseUIXdMv+IHto94Zrv5mE3/h KDxq/7bWkpGoaZbQZa3yv2htZBQ9sAPIQYJBuOAY/FpDtQaWxVKCb9nF2PiCzc4lm2jbQjYKs jimwDA6j11Wa7kHmY8okBNaxsHNH+0wJZr9+BulTs2I1cHCGCL+Rzi/l6nYfTqAmbQEcKDZMf 809SjF50j+Xt9lsK3xhP4QfmwJDThcv2i+zhkmzoxxOyqiZV9/AdU5CVF3C6MeUa6EfZtt68d fBPyd9O/BOWiIX8br0c0LGWNStaj5Azfprth2wX+7ikjC9Ws8cOWYQMHxFUUzVCtPcwIFb6A/ 83a/4ae5n/RVimEcQW+iGZKvzSaxRxjNYXPUtj45wNuhIpP/YTozGnuDVpGrvIV1Wsd0NAfL4 3n2xbxp4Vnqjq73aC7aoVn94SFKdcZtjg/JblwQQn4BHE4bj17s/xFYeuiQ4h/lMouLFm5BMo kYOM3Ckbfj9wjCq9yzLCUDtFuzj1GGcqVeM4i3JLAzR71Ox5HzLU/xK3jCD/3J8hDmjyw+hvS ysxVWEPsEW+RnFBu5Yvw9ANGOES60kgcfd+lh89NUBlF+fDtKB3bg97+5ElTjpdPze2sN9LaK Bni5z1+PV0BVYjZ4U2olawi3BAss6zIQudiitpcdSo/23lXCtKNY2xjswb6JP+J40Jn41eufB i1sS34VdQdTMvRMNDSgg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The local boot time variable gets truncated to time_t at the moment, which can lead to slightly odd behavior on 32-bit architectures. Use ktime_get_real_seconds() instead of get_seconds() to always get a 64-bit result, and keep it that way wherever possible. It still gets truncated in a few places: - When assigning to cl_clientid.cl_boot, this is already documented and is only used as a unique identifier. - In clients_still_reclaiming(), the truncation is to 'unsigned long' in order to use the 'time_before() helper. Signed-off-by: Arnd Bergmann --- fs/nfsd/netns.h | 2 +- fs/nfsd/nfs4recover.c | 8 ++++---- fs/nfsd/nfs4state.c | 14 +++++++------- 3 files changed, 12 insertions(+), 12 deletions(-) -- 2.20.0 diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h index 9a4ef815fb8c..29bbe28eda53 100644 --- a/fs/nfsd/netns.h +++ b/fs/nfsd/netns.h @@ -40,7 +40,7 @@ struct nfsd_net { struct lock_manager nfsd4_manager; bool grace_ended; - time_t boot_time; + time64_t boot_time; /* internal mount of the "nfsd" pseudofilesystem: */ struct vfsmount *nfsd_mnt; diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index 2481e7662128..a8fb18609146 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c @@ -1445,7 +1445,7 @@ nfsd4_cld_grace_done_v0(struct nfsd_net *nn) } cup->cu_u.cu_msg.cm_cmd = Cld_GraceDone; - cup->cu_u.cu_msg.cm_u.cm_gracetime = (int64_t)nn->boot_time; + cup->cu_u.cu_msg.cm_u.cm_gracetime = nn->boot_time; ret = cld_pipe_upcall(cn->cn_pipe, &cup->cu_u.cu_msg); if (!ret) ret = cup->cu_u.cu_msg.cm_status; @@ -1782,7 +1782,7 @@ nfsd4_cltrack_client_has_session(struct nfs4_client *clp) } static char * -nfsd4_cltrack_grace_start(time_t grace_start) +nfsd4_cltrack_grace_start(time64_t grace_start) { int copied; size_t len; @@ -1795,7 +1795,7 @@ nfsd4_cltrack_grace_start(time_t grace_start) if (!result) return result; - copied = snprintf(result, len, GRACE_START_ENV_PREFIX "%ld", + copied = snprintf(result, len, GRACE_START_ENV_PREFIX "%lld", grace_start); if (copied >= len) { /* just return nothing if output was truncated */ @@ -2004,7 +2004,7 @@ nfsd4_umh_cltrack_grace_done(struct nfsd_net *nn) char *legacy; char timestr[22]; /* FIXME: better way to determine max size? */ - sprintf(timestr, "%ld", nn->boot_time); + sprintf(timestr, "%lld", nn->boot_time); legacy = nfsd4_cltrack_legacy_topdir(); nfsd4_umh_cltrack_upcall("gracedone", timestr, legacy, NULL); kfree(legacy); diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 27a629cc5a46..1ac431aa29c4 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -753,7 +753,7 @@ int nfs4_init_cp_state(struct nfsd_net *nn, struct nfsd4_copy *copy) if (new_id < 0) return 0; copy->cp_stateid.si_opaque.so_id = new_id; - copy->cp_stateid.si_opaque.so_clid.cl_boot = nn->boot_time; + copy->cp_stateid.si_opaque.so_clid.cl_boot = (u32)nn->boot_time; copy->cp_stateid.si_opaque.so_clid.cl_id = nn->s2s_cp_cl_id; return 1; } @@ -1862,7 +1862,7 @@ STALE_CLIENTID(clientid_t *clid, struct nfsd_net *nn) */ if (clid->cl_boot == (u32)nn->boot_time) return 0; - dprintk("NFSD stale clientid (%08x/%08x) boot_time %08lx\n", + dprintk("NFSD stale clientid (%08x/%08x) boot_time %08llx\n", clid->cl_boot, clid->cl_id, nn->boot_time); return 1; } @@ -2222,7 +2222,7 @@ static void gen_confirm(struct nfs4_client *clp, struct nfsd_net *nn) static void gen_clid(struct nfs4_client *clp, struct nfsd_net *nn) { - clp->cl_clientid.cl_boot = nn->boot_time; + clp->cl_clientid.cl_boot = (u32)nn->boot_time; clp->cl_clientid.cl_id = nn->clientid_counter++; gen_confirm(clp, nn); } @@ -5183,9 +5183,9 @@ nfsd4_end_grace(struct nfsd_net *nn) */ static bool clients_still_reclaiming(struct nfsd_net *nn) { - unsigned long now = get_seconds(); - unsigned long double_grace_period_end = nn->boot_time + - 2 * nn->nfsd4_lease; + unsigned long now = (unsigned long) ktime_get_real_seconds(); + unsigned long double_grace_period_end = (unsigned long)nn->boot_time + + 2 * (unsigned long)nn->nfsd4_lease; if (nn->track_reclaim_completes && atomic_read(&nn->nr_reclaim_complete) == @@ -7640,7 +7640,7 @@ static int nfs4_state_create_net(struct net *net) INIT_LIST_HEAD(&nn->sessionid_hashtbl[i]); nn->conf_name_tree = RB_ROOT; nn->unconf_name_tree = RB_ROOT; - nn->boot_time = get_seconds(); + nn->boot_time = ktime_get_real_seconds(); nn->grace_ended = false; nn->nfsd4_manager.block_opens = true; INIT_LIST_HEAD(&nn->nfsd4_manager.list); From patchwork Fri Dec 13 14:10:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 181559 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp690674ile; Fri, 13 Dec 2019 06:11:06 -0800 (PST) X-Google-Smtp-Source: APXvYqyC9usZJUh7gGslDi7dMp/20Nt5pZtYW5tmQq3+w1Bch9tp001BBSv+cbvA5dWYbFNAEuEh X-Received: by 2002:a05:6830:1d1:: with SMTP id r17mr15702451ota.151.1576246266542; Fri, 13 Dec 2019 06:11:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576246266; cv=none; d=google.com; s=arc-20160816; b=ftwsi0JzpHf5WwS63rF90gCcnbDUkhx3fTz1I4Ho8DGvfKSPXcyGZxdHQ18Y4ZXjfq 1ecdjXRfPgARPAB4b65D42eCOjWL2A4J1JzIy2+WDasI9rjRzLpi77AkGiYKeM/0uYmI W5JyQijLue2j9ncq5TtYAFrJBgJMf+NFRoPWuI4zQOB9cr2J1gOIibpqLSGDfDdG6Djx AKkVCpitovvMV49EOdzT9dpNcJ4KNze1GGSWxmbjYFP1TPOJsMlZheET9GsjGmb//p/L pAMCOKaaqbzO+T0AR+OID3OiApuIZoMe5F/37qVeflBKTtPgymG+dY+2J4Gmix652//c M8og== 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=wEYvCGNC7plH2okWAz9OMvECXdrsqe7J5fAmYqPQYes=; b=Ek4MLaP83Rqt+K2+8Ds0/ltQo+W3Sufg2QACDgXEfexanry5hbLUv9+hVRe87qftuS NObLsjhyM5hHja/C8uqdqZ2ClLbkxRyPacdpXHZR340mPRVO2if9X77JGlJ9L58lBeaL BUzmzMALhTNOSEMsnIXDLxWttphXM3Mt3rOWFFvO+8KNfrphxUzw4GyEH6sEOeO3Kdsn kEK/Yd95laVZYuYRGKqN6d1tYkYnUtoHJ0twttYlUofUBjyngEhhjAv/VDy14tvY19Fb a3YFg6hD4Bn3agyBqHKG5yyvIdTZx5HcbXPEpv2yUoyx6Z9yaatUHQ+G00iYJTzLBacz QEBw== 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.06; Fri, 13 Dec 2019 06:11:06 -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 S1727708AbfLMOLE (ORCPT + 27 others); Fri, 13 Dec 2019 09:11:04 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:41309 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727569AbfLMOLC (ORCPT ); Fri, 13 Dec 2019 09:11:02 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.129]) with ESMTPA (Nemesis) id 1MTAJr-1iHwJ52Qnv-00UXmr; Fri, 13 Dec 2019 15:10:56 +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 06/12] nfsd: pass a 64-bit guardtime to nfsd_setattr() Date: Fri, 13 Dec 2019 15:10:40 +0100 Message-Id: <20191213141046.1770441-7-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:32H1E8vuq17NH2Cx7Vjm22p3ZCzBl6Ofe77Gpb5PjGXyE0MByqG Qe8AewdBTTn04K+UXAoEjWqdTSbuNlrt3u9k3GDQ00D0826A+JmZ6CwLDqhSf8QJ+19Lf4/ 9+NVRZNoiTqdylywasRZnkbGKjYuVewG6BpCdrqzvuOiXSCD6ZkM0Rwgj5lzYY+2Qr8ZL64 qFOZU0LWFyy3tjWqBNvxQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:vcCoIowR3aI=:aTY+fJ6vSdea/tBGyeGFLo RyeqFMHOXDHlijvgB9zL9U0QLiOwn1B0NZwNwFsVGbFTnAT5TU+xsHyzaPUXQwnwu/5r4vqzd v+VadyxdvpTaNOQw5wmJ/KstrSa7o5gENvdVNTEo8ZuQfvOs07KsZ5DD2A4yppl0MUQM38xzj xBBrGWyUOlIrkhWZNH6x+hfipMq4C3FzvfG+LrtPTse5OqCohck88JVE1mTkTHI3sg2+KkHTG jF9sSla2R0f/nrytEgTBcUQEG2buq5LK1S+eCzoTVz3S2N2q+3+/QNs8X2HTZ7d6fWXbfE5sW ms6UiN5db4ytofUqsccj8b3RMjxKsxZyYQaZEkxysP45KVt1ZqYDYaftsGUh9tQ5rrgpDcufB nK4x58IC45GEOgykLFlZF3vS+oqm00MCeO22cmvEjDy9GvBuAd6RdQDLMryZGTxf88jAiFDxK Q0XEVOcQmr4lgdADZGQEi+5v/iRbIRTjwsqzK0YRtzjnrtN520bteskuB9k4HWmOtV/I5H0jk 1CqdHxqNzK6ekqTYBqyDi5unJFeIXw3aPAKxylEGJX/dS6z0IjVh2CoaMuptXN7ey6gRsU36O s7ysMo2g7loPbuf8E1PPYb3LP/X8h7Tfvcnqawg3Kzki80mgk9phFnCknLqa3dDapqQ8IRpLP RvZS0ZILQKfN3/tq6XGNy71fj/29oMvtZX30EllOM+reLhPR35Rhwi+iDvRqWpSs8Q/Huuhb5 bT47b9q0vHrXpLTEtNYGJbcpJpc2+TLHB1WqRXymWMRi4hiW01bGnwbqWx1cUFmWwG+nEZQSk 26t/vaUYJsRRb9EvfVyhr+uklCr2C4X2EUbLYoF1ijiCylAiz+7triwDbT3B0mKOOW136+bCk c7/8aVgnq9m3doyBiJgg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Guardtime handling in nfs3 differs between 32-bit and 64-bit architectures, and uses the deprecated time_t type. Change it to using time64_t, which behaves the same way on 64-bit and 32-bit architectures, treating the number as an unsigned 32-bit entity with a range of year 1970 to 2106 consistently, and avoiding the y2038 overflow. Signed-off-by: Arnd Bergmann --- fs/nfsd/nfs4proc.c | 2 +- fs/nfsd/nfs4state.c | 2 +- fs/nfsd/nfsproc.c | 4 ++-- fs/nfsd/vfs.c | 4 ++-- fs/nfsd/vfs.h | 2 +- fs/nfsd/xdr3.h | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) -- 2.20.0 diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 4798667af647..bcf6803cf3a6 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -975,7 +975,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, if (status) goto out; status = nfsd_setattr(rqstp, &cstate->current_fh, &setattr->sa_iattr, - 0, (time_t)0); + 0, (time64_t)0); out: fh_drop_write(&cstate->current_fh); return status; diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 1ac431aa29c4..5cb0f774218a 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -4671,7 +4671,7 @@ nfsd4_truncate(struct svc_rqst *rqstp, struct svc_fh *fh, return 0; if (!(open->op_share_access & NFS4_SHARE_ACCESS_WRITE)) return nfserr_inval; - return nfsd_setattr(rqstp, fh, &iattr, 0, (time_t)0); + return nfsd_setattr(rqstp, fh, &iattr, 0, (time64_t)0); } static __be32 nfs4_get_vfs_file(struct svc_rqst *rqstp, struct nfs4_file *fp, diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index c83ddac22f38..aa013b736073 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c @@ -113,7 +113,7 @@ nfsd_proc_setattr(struct svc_rqst *rqstp) } } - nfserr = nfsd_setattr(rqstp, fhp, iap, 0, (time_t)0); + nfserr = nfsd_setattr(rqstp, fhp, iap, 0, (time64_t)0); done: return nfsd_return_attrs(nfserr, resp); } @@ -380,7 +380,7 @@ nfsd_proc_create(struct svc_rqst *rqstp) */ attr->ia_valid &= ATTR_SIZE; if (attr->ia_valid) - nfserr = nfsd_setattr(rqstp, newfhp, attr, 0, (time_t)0); + nfserr = nfsd_setattr(rqstp, newfhp, attr, 0, (time64_t)0); } out_unlock: diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index c0dc491537a6..fd5ba6997447 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -358,7 +358,7 @@ nfsd_get_write_access(struct svc_rqst *rqstp, struct svc_fh *fhp, */ __be32 nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, - int check_guard, time_t guardtime) + int check_guard, time64_t guardtime) { struct dentry *dentry; struct inode *inode; @@ -1123,7 +1123,7 @@ nfsd_create_setattr(struct svc_rqst *rqstp, struct svc_fh *resfhp, if (!uid_eq(current_fsuid(), GLOBAL_ROOT_UID)) iap->ia_valid &= ~(ATTR_UID|ATTR_GID); if (iap->ia_valid) - return nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0); + return nfsd_setattr(rqstp, resfhp, iap, 0, (time64_t)0); /* Callers expect file metadata to be committed here */ return nfserrno(commit_metadata(resfhp)); } diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h index cc110a10bfe8..bbb485177b25 100644 --- a/fs/nfsd/vfs.h +++ b/fs/nfsd/vfs.h @@ -48,7 +48,7 @@ __be32 nfsd_lookup_dentry(struct svc_rqst *, struct svc_fh *, const char *, unsigned int, struct svc_export **, struct dentry **); __be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *, - struct iattr *, int, time_t); + struct iattr *, int, time64_t); int nfsd_mountpoint(struct dentry *, struct svc_export *); #ifdef CONFIG_NFSD_V4 __be32 nfsd4_set_nfs4_label(struct svc_rqst *, struct svc_fh *, diff --git a/fs/nfsd/xdr3.h b/fs/nfsd/xdr3.h index 99ff9f403ff1..0fa12988fb6a 100644 --- a/fs/nfsd/xdr3.h +++ b/fs/nfsd/xdr3.h @@ -14,7 +14,7 @@ struct nfsd3_sattrargs { struct svc_fh fh; struct iattr attrs; int check_guard; - time_t guardtime; + time64_t guardtime; }; struct nfsd3_diropargs { From patchwork Fri Dec 13 14:10:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 181565 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp691068ile; Fri, 13 Dec 2019 06:11:24 -0800 (PST) X-Google-Smtp-Source: APXvYqzz+qI89LFaQPLfRFm6saLwhCUA9x7uxmpZ3+t/FedUOEON0QvCKIwalj5NX504ugqNIG4C X-Received: by 2002:a05:6830:2087:: with SMTP id y7mr14090094otq.96.1576246284676; Fri, 13 Dec 2019 06:11:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576246284; cv=none; d=google.com; s=arc-20160816; b=qCWumUeFs3WN6/oM2ehB0R3LGiAwVTz14YbnFXMCMu4tv8AVj7zlqShh8dScYQhZax 0g7c+GjRUp29VpKKDwqQc7EXlJE6l4TKiEsYpC9O/k3lrUJ46CRskjfjQKCIT6Y5s9bG ErtSkUAEFmA3z7yZcAztGJqqxT+N5HCIBPupOkb0wAOwzSUtgxHDyWjkkxVWI/IE1hP7 IEoZYnShPla8pJD9APIahpwfMpqJWYq9KWZmyyvgilGXmSp8MRkl4s86nChV8Uga41H6 LtFS9JA4eVk+zNvjXT80miJhO5Nn61wQoVSKTIDlGpCjZeALp23f1C8iR0VeFtUdm1py NL2g== 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=MAnuPeH8MQ7Zv2N6hh8mt/CD+gsk+ZTHINwLn0K3ukg=; b=IHoa7tlzEajimpelX7a/SxIQtCTq0CaCMZwPJdm79V0R/s6sg1dsneU1cX+4QHsfW7 mYF2kY1cLVJeKCY21uM+ClYkTU3gub6nyFkT9s8e9gKpm6VZ0w2kuqIQxW9Z8F9HnWf2 qs4M/1SVb+5EfgMlVsCXV8Gw03cyIE0PziseVzN5ETJ8iFYyPBBI+Bm6eNgTSm1Zcw06 4SEr9dlRX19eJe3grTeGDE9oM/lv4yjS3ue6JhqiZimE5/Kv/rdU894lp7numIWrsdxD lBu+8GAjgIXawF52NNxU/MVnaddudVrIwKPglMSKZ2UoFHw9YejLZ7n0newF1JqMaHdg 8OSA== 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 l26si5250259oti.152.2019.12.13.06.11.24; Fri, 13 Dec 2019 06:11:24 -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 S1727777AbfLMOLV (ORCPT + 27 others); Fri, 13 Dec 2019 09:11:21 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:47387 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727608AbfLMOLD (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 1MqatE-1htFXk3NMO-00mcAo; Fri, 13 Dec 2019 15:10:56 +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 07/12] nfsd: use time64_t in nfsd_proc_setattr() check Date: Fri, 13 Dec 2019 15:10:41 +0100 Message-Id: <20191213141046.1770441-8-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:sX4dzulNvI3GFKBUZrcox6lRFdAV/6K1BJ9TvA9ivOBNVK9j/Fq HRkqj1+KlXNIMOzBQU1Xwc0Zt8X512GFwS7+50tQv4ye+TTIUFaV+tPsdzIAz6k9IoK5zQv wLf5aSCwQeZZzhx0SN2yos9NOwz3b2R466i8u7lDzFbCYfMYmEXJmjelP1g3OleNKYHT+hX 7UqX81fHsFigibDLRpRHQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:4hTU0Zhy3NQ=:bv7zUqTP1evs5iKvCSg0Lm PWh+T4mOdKNjNJstivcGtjiydc7IZ3gSqHcbbPsCuoTVP+xMTWkYehmIyu1DcBjRL+ecLJ0+X ZJD6hl3vEk7hFKMqESnHpTYmz3MumF2cGk7ddeNT2/utJtc4hBxS04XIUs/SV5xPYH2ZDvrAV V4Zk8YSoj+98aKd3X/MklOsAEb4JJFI726yWsSywMOsHuJXvoP/1cwHgYIxP5nbnQOSdqK1df MOOvxp02OsMTr4p7iiPxAQ5EOviTs30gNQO/csbivnWmSH4xhXWREApWXjdAN//PvilsYetGe OE1Yi1pwNhLl2uNkSCsuPrsvXIr26+yNj7ZFvS9hJ5TpiVqZdk6ckdGbYRUlW3p/zPxgk8m3N NbPovt9gt9IOGOgIKjIESqCbrHCMyqQ0yJl973vWPUzMkIV6mchAOSb5HYXU/RfRjtTP2JOAk 2D2zNcQuJYp9YKWJg3YOcwqcdXKbCRZb0YIM4Zq53XJiL5YJOCojmcW3nA3ZHiOgCkfX4QhVz BL7U0W/rjW6fdpVJDl3gVbiqiCDqV7SqOjYA9Yi15VTgUFwp9Mrd+ZtANRvyRlyiw+FPNqiWj +06/ZeRJE4dBtPz6MXkLEmoFBtCvvqqskQJXNqxuB3mHi8MXtVaiZoCwVYDvzaoN1j7xdJT8n qqheUol17GKV+sNz5q9/7lHGfQm3PAVf4WXIx1RcnTAUzQ9jc2MslG+dNEuRc7I0PZmp9h9Pu Q/0gMb+f+gZnJi+lrT+OXQKtOIYJV+5cvTPpmgrXSJvgWQ6TCSwgt8R9IColqV1Nz4otLJ3wv LERsNwtkT11JsIdZEaP6cb3hVo17GSdMJzzc89I2xRPmFDhBATDB/jplloCjXF3+bnBbhGk0I RypZQYndZrym8+J9LvqA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Change to time64_t and ktime_get_real_seconds() to make the logic work correctly on 32-bit architectures beyond 2038. Signed-off-by: Arnd Bergmann --- fs/nfsd/nfsproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.0 diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index aa013b736073..b25c90be29fb 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c @@ -94,7 +94,7 @@ nfsd_proc_setattr(struct svc_rqst *rqstp) * Solaris, at least, doesn't seem to care what the time * request is. We require it be within 30 minutes of now. */ - time_t delta = iap->ia_atime.tv_sec - get_seconds(); + time64_t delta = iap->ia_atime.tv_sec - ktime_get_real_seconds(); nfserr = fh_verify(rqstp, fhp, 0, NFSD_MAY_NOP); if (nfserr) From patchwork Fri Dec 13 14:10:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 181567 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp691289ile; Fri, 13 Dec 2019 06:11:33 -0800 (PST) X-Google-Smtp-Source: APXvYqx1qZQs9RkmpKkpxXaTOOhNDtqFCpPMlbtnIIDZpPlSVZfdzC6vC639PERMYFFnCuHNibVO X-Received: by 2002:a9d:7085:: with SMTP id l5mr15387441otj.25.1576246293696; Fri, 13 Dec 2019 06:11:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576246293; cv=none; d=google.com; s=arc-20160816; b=ytPg5/1O+o4sb/oVs9T23W5NpsaDnE8JIwFXIpuPgaDeLbXQDvCadEa1M1E51ikDuz zyF5/SwyJNMaR2DP4G08cT4tPUjhFfTtO3p7rG3Uk4OgroD3Q21u25WEL4jRDorMgItu y8F1Hee2g/CK/3rVN8IVED/RIsIiQ5EKYY4f9N8rn4oZ2qGRzRXA03m2dEWkf/5Cdarz VkX8ODRvt8PzP04xz39V1MCTIuJwi8tWD019OLHqow1iM1Y6GKb2Zwz9nJBPQtgdcpiC gEsDBlaam717y4eG7OCJx2F976pgXuLvg51JQhWzlFLKPF6rgKmv5Sekuu0qa/9EsNV7 /lYw== 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=y5u09Q2uGLzFAPd29bVuz8BA6CP1XYaqAfo4C0KZH9c=; b=YIIOP9p1OqUAhO512fPrEE7i6ZV7sJ4Z+k6QBy+Lr36sbQmKnwSmsGfWDm6ac+4X56 hy7YMAWescBODE06q03rVAqKG0iLM4EwPEH1ixb0YLkflzRpkLjPwpAJ65X2JI9vR9n+ TGjxGb+sIz0VmUQnVGwvvVHGGZsX/V34NNvLzToK5I6DVws0i8cyqN9cSDz1GuA4hD9H 8kNTm95SpDFBU5kCgQZKt9gXayQsshJ7tklBKoB1zmIqwe5ot6XsRjAK0J45Q+dDrwHr u53uWO4QJ/dwLRvBmklGMAYZcaDI22hFv2Tyom59Jk3Xy13AW8E2aFaxs+x3gSCkqqq0 4vgw== 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 l9si4840867otn.301.2019.12.13.06.11.33; Fri, 13 Dec 2019 06:11:33 -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 S1727800AbfLMOLc (ORCPT + 27 others); Fri, 13 Dec 2019 09:11:32 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:34069 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727602AbfLMOLD (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 1Mwfj0-1hm7jP0CVe-00y7RM; 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 08/12] nfsd: fix delay timer on 32-bit architectures Date: Fri, 13 Dec 2019 15:10:42 +0100 Message-Id: <20191213141046.1770441-9-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:Ozu4/pW+qCLxecDh3MKrULZcF90m6hSpu021bvKefFoHkHEq9Ku shomPCLvJLy6Epoe1gwNj87M2yyVRlRTjcE1uGBY+fBu2xOkTAcJaqkxClVYajDllbEEsEE UznBhgfNHcVaIuEGBOuzRVu/h3WdhTHRdqa37WSuvJ8k+AA3Hla25u2Im4zr7eNRk5M96/C XW4TFyNNfbucorssE6dmg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:xuhYPSf0wgU=:io1itl3p42GbQW92RFBuA+ 4gnILpuRAdX4u2bzsTAQA5ODcN6kOT6oOj8/AHpZFWau6BZmM/U2pAiKFn/gvqG9qhcO8ix89 cbA0m9fDlvBgA9g6GcjxNyzvIZ6kFEOHWwf/sfqxYeysdRE234R2v4W4DKI6zBNWKR2tMxF8y aObBRkAoK3lTRNznjEf5vLWGIkLeznTEEME26UMN/OlWkdCtPKmvVAdV8Q8VMFPkjAOP7a+lt M+ddORi4ccutIEtU7ZJmIJKZz9ho1RJapgll/ls3piNBe//DFulDSSKAos5+SdOB53NE6/yxO HHKXsvMJf2budQ8AVP1jOlbCW0tEgk/PAnNQ//yg1n/DfeoUxqmhheXAIgsHBd+7gdIrE0yvy l91HRZorgdAhUlCPonat0PN9M7HCOnWtKyWES60ZfvZ5YaPGFcRCSS/ATCkL5QZfQ/K0pxkn9 A1A7P/hBV8V4PO7q45DulM1C8lDGo+TI4Mb5KD7RxP53/yZ7X/iAY222useB8phaDcTf5sReN nwcE2SQjgZb4hezlKnspbCpl8RgdetnHrjK+FoRNj0TXviClHW4IosW+gakeBGUJoEQLATPHH /60w7BbuqArdaxd3+M09XNBkGujPDjMvdfLCPQtzHuhNHoocndClfoHoxRPW4AWj49PfcQ2PN 9MU88JRvfU/+A8fupAnUlXs1pJE56vyLELZCyPxKVLeksTmsrpKEdrE1pkjOSVrOiKY7kzQ+S oMhgwJcoWKibcSyhgRZds1GI+yFEIzJX8gI7oZNgE0l50q6miGjcJ0e7FlIRW0RJsI4ABHfS9 PcucIbOr6HcyeslBNCzwUyaJHW/0rZZtKLelcrz6wYnz4MQn/IeeE4g6eGtTcuN7JmGyE2psx cMgxXcmxZ6OnldX6+30A== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The nfsd4_cb_layout_done() function takes a 'time_t' value, multiplied by NSEC_PER_SEC*2 to get a nanosecond value. This works fine on 64-bit architectures, but on 32-bit, any value over 1 second results in a signed integer overflow with unexpected results. Cast one input to a 64-bit type in order to produce the same result that we have on 64-bit architectures, regarless of the type of nfsd4_lease. Fixes: 6b9b21073d3b ("nfsd: give up on CB_LAYOUTRECALLs after two lease periods") Signed-off-by: Arnd Bergmann --- fs/nfsd/nfs4layouts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.0 diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c index 2681c70283ce..e12409eca7cc 100644 --- a/fs/nfsd/nfs4layouts.c +++ b/fs/nfsd/nfs4layouts.c @@ -675,7 +675,7 @@ nfsd4_cb_layout_done(struct nfsd4_callback *cb, struct rpc_task *task) /* Client gets 2 lease periods to return it */ cutoff = ktime_add_ns(task->tk_start, - nn->nfsd4_lease * NSEC_PER_SEC * 2); + (u64)nn->nfsd4_lease * NSEC_PER_SEC * 2); if (ktime_before(now, cutoff)) { rpc_delay(task, HZ/100); /* 10 mili-seconds */ 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; From patchwork Fri Dec 13 14:10:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 181566 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp691117ile; Fri, 13 Dec 2019 06:11:26 -0800 (PST) X-Google-Smtp-Source: APXvYqz6BpECI7fBRhWXWlZFVgu5VeLPX3wp5M/X1FpngHi487+ajcXTE9k/tEq0tZbvcYQY9TgL X-Received: by 2002:a05:6830:1141:: with SMTP id x1mr15138362otq.120.1576246286747; Fri, 13 Dec 2019 06:11:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576246286; cv=none; d=google.com; s=arc-20160816; b=SiaXQ4uul/wqZlfzrW7cMWqzzC4CFdmUyLGmVmG3q4Pf77/BAPvYKUJexHaC3Uuef+ CikzK7eG+LC0YFM99aFwkhc2ZqJyeOdiXeUQuRtlfUoaV4Amt5GHr19sKxDBCxao/OsY J+bCwIf1llgiVKdnD6ZbX3mjdi2bCXczZbMzgDd92w1xNQnfwknb0ruHJkk0kYbYwmLJ 9jIRHEwWJRphDm31jIQfw8mcnU9LKB+E97C5Ey0MQLTemec7ZbH/rZCF20xVY/OzbHMm Jx1ZsSTtjJxAwSUIX2yCDpHHec8e1HR44ssVVu4Wt3QlszTZBqKpinCtqH9LVs2O+7xI hXBA== 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=v5EaD7i/NHOqOeqSW39qizvZwJbFPt3QXJ05l66vIbg=; b=n42N7xyN9T19zMXc46KFqB1zSbF17B3ZjF3IoUQGMafoxrMMFCB1+0F8oJxOR5lDyu OYyFe2BSxSSe6LB53xti+8iQFxlQ51GksFNTPpALlNP9KIaOsNT1ZqZ/Q1O8T4eqwuxl pX9QYYK2hG72eYhz51RuobtJ4zty8zJCVIFpaQGEgLMmeIaPQom5dsCJhdJNPqQHnHAn evCbZaXUjnwKsZs+N47Xm8aH2D3fhovwI2TI+eta3G5Jzwpoi9InKRm9OdTdLCoBmecu xZxhHYhJBZjnFJkhDUDT2qv5B9Ry5BdywHOLFQsdmkmiG/zKPmhFTTVvw592+Uj2tXzz 7T0w== 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 l9si4840867otn.301.2019.12.13.06.11.26; Fri, 13 Dec 2019 06:11:26 -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 S1727764AbfLMOLU (ORCPT + 27 others); Fri, 13 Dec 2019 09:11:20 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:55015 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727606AbfLMOLD (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 1MORN0-1iMZ0p2CTu-00Pt5E; 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 10/12] nfsd: use boottime for lease expiry alculation Date: Fri, 13 Dec 2019 15:10:44 +0100 Message-Id: <20191213141046.1770441-11-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:JFkufX2RpPtqUXkrs0Ur9nKmflv0VqH9bQrXyNgMlle8UwMPP+4 WNc78jN4t7CQ2PMmTWkFprAQRuqSHQl+PHH4h0/cR4qMhnO51kphwHGGymLBjn89P5xV7fq T0YEXUDAG7tppHkajPWkn+DFNqhS/3jBBgreuoxVyaoKVGx8K4xwSR0zodb/YYNGXfeJ5KX N4m7JkNFQVFHU3ZiY+aNw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:bxGxv3tNaps=:l/1rvgM1k4DfCJY81jUd4w yHrHwmI4Gw3GjuTqYwrw/D1yCSCRTMzREWaUwGROFp5CBugxGmOpU5rSnydlZpIRiamXwRhRK IXUjcUEzQtzdjxoFdXUIbH0WZDr6L2Dh+b0zh+HhZbVXFO+Xhe1KQsGuGsQevLp1/uvVFSDek y71RirKm288O58hPRg4hNs5OstGuuByCDOE4qzxQXux5+xD56TTzgF9Vz2Lyr6Qca4mGraJ/v 0vqgcFVCU6UpbnGupH/lvbipTmUhv24E8/+CwE7o5Q3AQKyhPsJwsN36ig7szYJwzG9BhcguC oReujDRE7Vwe4lT0eAiJ+idcsZENf1ZSB56I+a9lkP0y1lF/7OOKFQ8q+tIU/4uQcALzAyOiq Kg3OrdSdLJFu+eUw6LtliyssMrPed0170GgvDTH+nfmP3vQPcrE0W1XgOP95jpjVH4Fgc5sa4 2TIIXYCg3Z/ls8fCSEfqkv5JmvvvwraCZgjcDADmbcIEu6z4H5kd+hNubp5tbt6EnpvYy/Lmn AE7T6HhUSE6UG0FJrLuYUHtwLzpaVL3j4yzEWEZyAD/Y64a6m5G2fdJFJyvPWwx80+O4ZdLP3 hLdLPGxF3RYVYYmB0P8pYQUfBjOTZlUQpxzIvErzXZU1OnVX7M6z587p75h+TAVVjwysKNkw7 i6JxYQIzoXZSqcaimt8GbEifv6p4i8Pukal445qGPO56A+S3vZkcMYQ9VmIp8EARDMcygrsal w/TcXyuychb/ZQkkqtUSzM5grS/t0GgNZ9ORar34oK327E2s8kWRu6rD5y5Ba7BAngcL7DfpH 1s40CUWA8RX0PkEOPSZUrhZfXbahtMAWZia5mA2SwZQgZCgTyI6NVshjdy7ow6+w+z5ZsMXdL 0U5gTAOgQw3M2q/vWxYw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A couple of time_t variables are only used to track the state of the lease time and its expiration. The code correctly uses the 'time_after()' macro to make this work on 32-bit architectures even beyond year 2038, but the get_seconds() function and the time_t type itself are deprecated as they behave inconsistently between 32-bit and 64-bit architectures and often lead to code that is not y2038 safe. As a minor issue, using get_seconds() leads to problems with concurrent settimeofday() or clock_settime() calls, in the worst case timeout never triggering after the time has been set backwards. Change nfsd to use time64_t and ktime_get_boottime_seconds() here. This is clearly excessive, as boottime by itself means we never go beyond 32 bits, but it does mean we handle this correctly and consistently without having to worry about corner cases and should be no more expensive than the previous implementation on 64-bit architectures. The max_cb_time() function gets changed in order to avoid an expensive 64-bit division operation, but as the lease time is at most one hour, there is no change in behavior. Signed-off-by: Arnd Bergmann --- fs/nfsd/netns.h | 4 ++-- fs/nfsd/nfs4callback.c | 7 ++++++- fs/nfsd/nfs4state.c | 41 +++++++++++++++++++---------------------- fs/nfsd/nfsctl.c | 6 +++--- fs/nfsd/state.h | 8 ++++---- 5 files changed, 34 insertions(+), 32 deletions(-) -- 2.20.0 diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h index 29bbe28eda53..2baf32311e00 100644 --- a/fs/nfsd/netns.h +++ b/fs/nfsd/netns.h @@ -92,8 +92,8 @@ struct nfsd_net { bool in_grace; const struct nfsd4_client_tracking_ops *client_tracking_ops; - time_t nfsd4_lease; - time_t nfsd4_grace; + time64_t nfsd4_lease; + time64_t nfsd4_grace; bool somebody_reclaimed; bool track_reclaim_completes; diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 24534db87e86..508d7c6c00b5 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c @@ -823,7 +823,12 @@ static const struct rpc_program cb_program = { static int max_cb_time(struct net *net) { struct nfsd_net *nn = net_generic(net, nfsd_net_id); - return max(nn->nfsd4_lease/10, (time_t)1) * HZ; + + /* nfsd4_lease is set to at most one hour */ + if (WARN_ON_ONCE(nn->nfsd4_lease > 3600)) + return 360 * HZ; + + return max(((u32)nn->nfsd4_lease)/10, 1u) * HZ; } static struct workqueue_struct *callback_wq; diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 9a063c4b4460..6afdef63f6d7 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -170,7 +170,7 @@ renew_client_locked(struct nfs4_client *clp) clp->cl_clientid.cl_boot, clp->cl_clientid.cl_id); list_move_tail(&clp->cl_lru, &nn->client_lru); - clp->cl_time = get_seconds(); + clp->cl_time = ktime_get_boottime_seconds(); } static void put_client_renew_locked(struct nfs4_client *clp) @@ -2612,7 +2612,7 @@ static struct nfs4_client *create_client(struct xdr_netobj name, gen_clid(clp, nn); kref_init(&clp->cl_nfsdfs.cl_ref); nfsd4_init_cb(&clp->cl_cb_null, clp, NULL, NFSPROC4_CLNT_CB_NULL); - clp->cl_time = get_seconds(); + clp->cl_time = ktime_get_boottime_seconds(); clear_bit(0, &clp->cl_cb_slot_busy); copy_verf(clp, verf); memcpy(&clp->cl_addr, sa, sizeof(struct sockaddr_storage)); @@ -4282,7 +4282,7 @@ move_to_close_lru(struct nfs4_ol_stateid *s, struct net *net) last = oo->oo_last_closed_stid; oo->oo_last_closed_stid = s; list_move_tail(&oo->oo_close_lru, &nn->close_lru); - oo->oo_time = get_seconds(); + oo->oo_time = ktime_get_boottime_seconds(); spin_unlock(&nn->client_lock); if (last) nfs4_put_stid(&last->st_stid); @@ -4377,7 +4377,7 @@ static void nfsd4_cb_recall_prepare(struct nfsd4_callback *cb) */ spin_lock(&state_lock); if (dp->dl_time == 0) { - dp->dl_time = get_seconds(); + dp->dl_time = ktime_get_boottime_seconds(); list_add_tail(&dp->dl_recall_lru, &nn->del_recall_lru); } spin_unlock(&state_lock); @@ -5183,9 +5183,8 @@ nfsd4_end_grace(struct nfsd_net *nn) */ static bool clients_still_reclaiming(struct nfsd_net *nn) { - unsigned long now = (unsigned long) ktime_get_real_seconds(); - unsigned long double_grace_period_end = (unsigned long)nn->boot_time + - 2 * (unsigned long)nn->nfsd4_lease; + time64_t double_grace_period_end = nn->boot_time + + 2 * nn->nfsd4_lease; if (nn->track_reclaim_completes && atomic_read(&nn->nr_reclaim_complete) == @@ -5198,12 +5197,12 @@ static bool clients_still_reclaiming(struct nfsd_net *nn) * If we've given them *two* lease times to reclaim, and they're * still not done, give up: */ - if (time_after(now, double_grace_period_end)) + if (ktime_get_boottime_seconds() > double_grace_period_end) return false; return true; } -static time_t +static time64_t nfs4_laundromat(struct nfsd_net *nn) { struct nfs4_client *clp; @@ -5212,8 +5211,8 @@ nfs4_laundromat(struct nfsd_net *nn) struct nfs4_ol_stateid *stp; struct nfsd4_blocked_lock *nbl; struct list_head *pos, *next, reaplist; - time_t cutoff = get_seconds() - nn->nfsd4_lease; - time_t t, new_timeo = nn->nfsd4_lease; + time64_t cutoff = ktime_get_boottime_seconds() - nn->nfsd4_lease; + time64_t t, new_timeo = nn->nfsd4_lease; dprintk("NFSD: laundromat service - starting\n"); @@ -5227,7 +5226,7 @@ nfs4_laundromat(struct nfsd_net *nn) spin_lock(&nn->client_lock); list_for_each_safe(pos, next, &nn->client_lru) { clp = list_entry(pos, struct nfs4_client, cl_lru); - if (time_after((unsigned long)clp->cl_time, (unsigned long)cutoff)) { + if (clp->cl_time > cutoff) { t = clp->cl_time - cutoff; new_timeo = min(new_timeo, t); break; @@ -5250,7 +5249,7 @@ nfs4_laundromat(struct nfsd_net *nn) spin_lock(&state_lock); list_for_each_safe(pos, next, &nn->del_recall_lru) { dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru); - if (time_after((unsigned long)dp->dl_time, (unsigned long)cutoff)) { + if (dp->dl_time > cutoff) { t = dp->dl_time - cutoff; new_timeo = min(new_timeo, t); break; @@ -5270,8 +5269,7 @@ nfs4_laundromat(struct nfsd_net *nn) while (!list_empty(&nn->close_lru)) { oo = list_first_entry(&nn->close_lru, struct nfs4_openowner, oo_close_lru); - if (time_after((unsigned long)oo->oo_time, - (unsigned long)cutoff)) { + if (oo->oo_time > cutoff) { t = oo->oo_time - cutoff; new_timeo = min(new_timeo, t); break; @@ -5301,8 +5299,7 @@ nfs4_laundromat(struct nfsd_net *nn) while (!list_empty(&nn->blocked_locks_lru)) { nbl = list_first_entry(&nn->blocked_locks_lru, struct nfsd4_blocked_lock, nbl_lru); - if (time_after((unsigned long)nbl->nbl_time, - (unsigned long)cutoff)) { + if (nbl->nbl_time > cutoff) { t = nbl->nbl_time - cutoff; new_timeo = min(new_timeo, t); break; @@ -5319,7 +5316,7 @@ nfs4_laundromat(struct nfsd_net *nn) free_blocked_lock(nbl); } out: - new_timeo = max_t(time_t, new_timeo, NFSD_LAUNDROMAT_MINTIMEOUT); + new_timeo = max_t(time64_t, new_timeo, NFSD_LAUNDROMAT_MINTIMEOUT); return new_timeo; } @@ -5329,13 +5326,13 @@ static void laundromat_main(struct work_struct *); static void laundromat_main(struct work_struct *laundry) { - time_t t; + time64_t t; struct delayed_work *dwork = to_delayed_work(laundry); struct nfsd_net *nn = container_of(dwork, struct nfsd_net, laundromat_work); t = nfs4_laundromat(nn); - dprintk("NFSD: laundromat_main - sleeping for %ld seconds\n", t); + dprintk("NFSD: laundromat_main - sleeping for %lld seconds\n", t); queue_delayed_work(laundry_wq, &nn->laundromat_work, t*HZ); } @@ -6549,7 +6546,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, } if (fl_flags & FL_SLEEP) { - nbl->nbl_time = get_seconds(); + nbl->nbl_time = ktime_get_boottime_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); @@ -7709,7 +7706,7 @@ nfs4_state_start_net(struct net *net) nfsd4_client_tracking_init(net); if (nn->track_reclaim_completes && nn->reclaim_str_hashtbl_size == 0) goto skip_grace; - printk(KERN_INFO "NFSD: starting %ld-second grace period (net %x)\n", + printk(KERN_INFO "NFSD: starting %lld-second grace period (net %x)\n", nn->nfsd4_grace, net->ns.inum); queue_delayed_work(laundry_wq, &nn->laundromat_work, nn->nfsd4_grace * HZ); return 0; diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 11b42c523f04..aace740d5a92 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -956,7 +956,7 @@ static ssize_t write_maxconn(struct file *file, char *buf, size_t size) #ifdef CONFIG_NFSD_V4 static ssize_t __nfsd4_write_time(struct file *file, char *buf, size_t size, - time_t *time, struct nfsd_net *nn) + time64_t *time, struct nfsd_net *nn) { char *mesg = buf; int rv, i; @@ -984,11 +984,11 @@ static ssize_t __nfsd4_write_time(struct file *file, char *buf, size_t size, *time = i; } - return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%ld\n", *time); + return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%lld\n", *time); } static ssize_t nfsd4_write_time(struct file *file, char *buf, size_t size, - time_t *time, struct nfsd_net *nn) + time64_t *time, struct nfsd_net *nn) { ssize_t rv; diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index 03fc7b4380f9..e426b22b5028 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h @@ -132,7 +132,7 @@ struct nfs4_delegation { struct list_head dl_recall_lru; /* delegation recalled */ struct nfs4_clnt_odstate *dl_clnt_odstate; u32 dl_type; - time_t dl_time; + time64_t dl_time; /* For recall: */ int dl_retries; struct nfsd4_callback dl_recall; @@ -310,7 +310,7 @@ struct nfs4_client { #endif struct xdr_netobj cl_name; /* id generated by client */ nfs4_verifier cl_verifier; /* generated by client */ - time_t cl_time; /* time of last lease renewal */ + time64_t cl_time; /* time of last lease renewal */ struct sockaddr_storage cl_addr; /* client ipaddress */ bool cl_mach_cred; /* SP4_MACH_CRED in force */ struct svc_cred cl_cred; /* setclientid principal */ @@ -449,7 +449,7 @@ struct nfs4_openowner { */ struct list_head oo_close_lru; struct nfs4_ol_stateid *oo_last_closed_stid; - time_t oo_time; /* time of placement on so_close_lru */ + time64_t oo_time; /* time of placement on so_close_lru */ #define NFS4_OO_CONFIRMED 1 unsigned char oo_flags; }; @@ -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; - time_t nbl_time; + time64_t nbl_time; struct file_lock nbl_lock; struct knfsd_fh nbl_fh; struct nfsd4_callback nbl_cb; From patchwork Fri Dec 13 14:10:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 181569 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp691431ile; Fri, 13 Dec 2019 06:11:40 -0800 (PST) X-Google-Smtp-Source: APXvYqyLMx90t5lhXeJ3e7tOiXeI8jEOO0UgC6O2IzHKYud0TagqvSJ4t+iVqJHBKG5J1HeH6pXn X-Received: by 2002:a9d:5c1:: with SMTP id 59mr15101961otd.192.1576246300648; Fri, 13 Dec 2019 06:11:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576246300; cv=none; d=google.com; s=arc-20160816; b=c2FEOgKyCRWyT9C6KImpAw3RYSgF4PQn7Au5ImfUnVics9yoj/pb0VNAxhQPvBeKm9 L2GJrI6UCJvSnDpTPyZeWHZLm1UNXY6wxjX04SKtNh4Izv+dT/WyrZw2r6elvt35KxTd LdkHFbDJQF3lI0r1ESft4EF9jR4vjgzYAfix7+Uh9gyRhVOsUqthGclY5Rqk3HMGKEA0 aM8vcXW7GYyvR5JpERg/vgG0/V+2sWbPd+lMVMKy7/sqMa/SIIl/Pxq8ZuLnVGhy3u0f tD7E09ENiB+047xm7/pJkv9+cBJ5WlgSzYr+BUD+iL2sCpcsjwPuTqIS6DTH4UbzdOOn 5KAQ== 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=vK7ZBqast0ydUemX21Dob2PnAFQAK0wM7larYArcNv8=; b=eofpex2WzanqEQ4G36FxO9docQVU1qDFF2yUWcoNE999vMfNyG+mZScw9jpyIw4HhU indTl1F3KxbYoqFFRkj+g+icqkCkpYxokELHMVUuWyeEq9x6lvz7iRJl/zwDLo/xisJj dzD4bJRbtrX5P6ahjP3Ldm+aktTPSZKAGYzcCSrRePDNXucHqNGUVTq6/TaD0domS3NC xFylgsMx4MSQKcCWryPmFRAZX/oozNyi2zLIkDJWTLWJl+o3sztJA5Ba9ilOtOUYkghG dVmv+QrRpkoG48/TAoKrEk3l1f9GGyOYVEhuu7oCERedWAWYB9P1rMSy8juVhC/Vmnsa HKrw== 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 f16si5135005otp.198.2019.12.13.06.11.40; Fri, 13 Dec 2019 06:11:40 -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 S1727812AbfLMOLi (ORCPT + 27 others); Fri, 13 Dec 2019 09:11:38 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:36859 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727573AbfLMOLD (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 1Mi2BV-1i1js033dh-00e7iJ; 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 11/12] nfsd: use ktime_get_real_seconds() in nfs4_verifier Date: Fri, 13 Dec 2019 15:10:45 +0100 Message-Id: <20191213141046.1770441-12-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:Pwg4ldcY+PirxuTk1NxKPR/wF0W7omnIpEhR4gWAXHpGQfencqU 9EjmqFwbCPgYhBby6Q3tH+JCuKvm94AFXcEYbOtHvvBFf6t6QfakjHUFeX/9+wZ0WXOnnAf 7Mj6sSgdq943phWuTRM8iA4/sHo+J04C+yauSKBDSHlxJ9ALUWqh/3hNXScfaod4Jm4H6EW TL/F8Z4OBfXWFGiYY0ojA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:taJeJc826rg=:gsJimcb309nz2tjW+nHMfT GfN+0U2212OBpxgW7egoFIGQ862g/bQvkrGmWwk6BlCUv2H3GGv3fwNrtYdaW/Q+PjOJZmAJk +dK25vCWRztDD50tdguuWnRXx875Hn+wEVYv/6TkFFDaMqRqmNefb4exZPSbWpniFe/lCeZW4 7B/FJM5yqkx3yVZvol7G4KSTp/totkFhFKDnr58T4mvRXNnqzhQeai5WL5hcA6AeONLwFSK6d iIQVqN/4hswZCeNX34EDDwDAKjreQA8NFkfUCLMOO7UBArxETkwq4GJqgh7Fnc6B6zSsrabv3 HrrvQf0GEA1aVb/YDSqqfNhszpmPDG2YhJkrtc813TrR9WJfXCz46oNiJ8vdZ0KSODbvy3Pvn 4SAgh0DX41V96BZuFQOxt6lAlkcjWyFoooimY6kte2bluDN1Fi5RnBjrDDjgtumWA0Yho2LEN H8J2vSmFqLDUI5yGWhnR9qw9aMPe/swv/fuTTNLztVdcTwoFtsxQTGcDQkgHEeawX2UvCL5Zo PQJpcU1Tqdhw6S/gbwImUkqrbfOdpL9InZWTE6UBmtlHX1VpUx/hprHP0MtW+D7gMfZz6J0S4 SCRv1BGJLJMOEl18unsekpH0O56m+qfl+h2S4MX5IxxiMXeuLtz5qYWMpoRqypa0PQfa5LTtd HQybvMPDK334iImyClesbRDePlvRHikkYSfP2RYsvuRgjX77uAP23PrPk568aer4mRcsDM7wB rIeR6WDUn9NFERKrHVuW3Ke+/Sdszf16X9oA6Sf/kN2xVZYxQLKs2PG5VUepNbX1Apchz0nYz 3PSpZK+XI5D/ctMMzt8O3Z6Lrvy2GNRKiDresjBT5jiAADMswqQkrvYa0GQkmC4ec3a++HXgJ 8HHnwgNFBKTuyN4ERjSQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org gen_confirm() generates a unique identifier based on the current time. This overflows in year 2038, but that is harmless since it generally does not lead to duplicates, as long as the time has been initialized by a real-time clock or NTP. Using ktime_get_boottime_seconds() or ktime_get_seconds() would avoid the overflow, but it would be more likely to result in non-unique numbers. Signed-off-by: Arnd Bergmann --- fs/nfsd/nfs4state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.0 diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 6afdef63f6d7..efe3161f6cf7 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -2215,7 +2215,7 @@ static void gen_confirm(struct nfs4_client *clp, struct nfsd_net *nn) * This is opaque to client, so no need to byte-swap. Use * __force to keep sparse happy */ - verf[0] = (__force __be32)get_seconds(); + verf[0] = (__force __be32)(u32)ktime_get_real_seconds(); verf[1] = (__force __be32)nn->clverifier_counter++; memcpy(clp->cl_confirm.data, verf, sizeof(clp->cl_confirm.data)); } From patchwork Fri Dec 13 14:10:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 181563 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp690896ile; Fri, 13 Dec 2019 06:11:16 -0800 (PST) X-Google-Smtp-Source: APXvYqx+CMELYHGdelluQD/UEtZwLbfu+MRD9mu4oUTRb+YuUHjQ0EJDM+yp7W+eTNC/TvZIenV1 X-Received: by 2002:a54:4117:: with SMTP id l23mr6559565oic.140.1576246276776; Fri, 13 Dec 2019 06:11:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576246276; cv=none; d=google.com; s=arc-20160816; b=Jrs3Y4V4DLy4NJrTroiDXJ4ue0rSZkMDcQvpVKwKtSZDPsk6dtg5M9feFETsKY4h8b 2NYzSZf+lqdDpPCFrixsSnEmET52/tbWAIFMdWbnd2ThD+He85seM5ZMGyP5W448UNSC M0MnL06Ua/XEycl7yBXV6IvAbQ+vI7xsJt8nPnOCWLvTDYJF1Ha4famFbwCYf+6Q5qGp LCIHP0TMwOwWEuLM2wCe3h8Y5/4wVaB8MHblcOrJmAvf+7Ko8TCnJj57cqKjXVewn4nC P0ZEa+Gby9vgEF+pLc5lLRB9+Y0QGtM/XJTve/AqkfrTTbuTSps/WJY3U3aHXt5KAYT8 b9sw== 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=G7UkVFt4xKb3vykFRyTE8zY4Zu/eh0ILuPBWqFzwIb8=; b=RT2lwUzIJMUruE920VKtL3p+BEi8/qKfEYdsdKtJKiRWoyLH1aVl8Q3YYRy1SPoXqv /SGh212RJ/QBlXEhU4e9E+hV0kc4JcqmQg+8A2JjVICfMbnAAORKwZ1TCQBpZodbWnY2 8MG/oj2xQiu18P0Hb/kfcvc5CRMQO+mbqjTxpGH3fa6m6Ifz5WwBwjm8FKhCyV/0oqEL azedlbs4ME0xwEu28YTmDF5HcM3pXNZcOMNnNwuv+dbCWN5st/VcLgXflx1hvYi7csw2 RdjSJeFH75CikF8C9dKyYGB83mEgru3s9EXS+LV+bqu9VL49fMSmi8xw4ErYoeCqLrKE 6yrg== 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 r5si4768949oic.19.2019.12.13.06.11.16; Fri, 13 Dec 2019 06:11:16 -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 S1727735AbfLMOLL (ORCPT + 27 others); Fri, 13 Dec 2019 09:11:11 -0500 Received: from mout.kundenserver.de ([212.227.126.130]:50571 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727666AbfLMOLE (ORCPT ); Fri, 13 Dec 2019 09:11:04 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.129]) with ESMTPA (Nemesis) id 1MK3eI-1iQyrf475S-00LVMW; Fri, 13 Dec 2019 15:10:58 +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 12/12] nfsd: remove nfs4_reset_lease() declarations Date: Fri, 13 Dec 2019 15:10:46 +0100 Message-Id: <20191213141046.1770441-13-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:ZKDoE9QgssUEaF4ESIVfDgM6JJvUm/C6dyGIwg+yexjRBcXrUwm hst4t6IX7xAaZVaj/pOiP9MP7i6dIkJDNDt0a+FHxmxT1X1k0C+p7+Ws/qj5gef0dozZQ2B qLHaEEbKkSXSec+anp6BztnEkbxv1Wa6tunbyUd/NoOGcetuTEK04Q4jFRbxBLBGjRvm0ZS GLiZZqTHprSm8m6ItitfQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:IbM7yEiXipE=:6X7jwtgzmmb9MKvUnt9E0Y dXCOBP06ZrqB3cgtvswg5L3oHYNBYrspPiM5rwALF0quasoWzYagSSjZvX3QErsP9Vx8sgm65 tJaji1xG9BMEWCKqmG70OGUBdqpeQ/qpwZxrDUaQA+R1vsFZMAH7IsmVYGkbWUjhgysRlfAhQ G+xxqSEMW3S4xlbBmU4RXsk2BImOt5aXmPQzIiS7ej8VDcXcUqds5+WAw2dyQuZvVWnQCGP7f BPO94IBvxRPFgAMVtN83yhn4tZQ4L6TWg9u7aGwwRh0vvrxuK/sX7T0SEJK9ELGCzJ9uzhKug ZY98E1SQWDUs0WWHh+EwsXYqqda/S1BMTuoX7elPUQnsf6DQKnK9T5KyiiOq5YhhEUJ25Mgd+ +FSswh/Y7xq4hIYXtvBn51twcQLK/QZCzRGBj/q378QlvI1gcgz/Rd2eBJT9lLvtG3wnveyJJ 53TSww8LgvMndlhYIo/CNyXRByQva8XaP8+ICFcLaFCNvZ94+Ew0ljzaPIW8uXZRTOVxcTgRB tb4QHALggAbZSCmo173owo3uK8H9pDr3EXMVlwfqwrpgfAbggI4CQ57nNAVrrUMu1plgiP7+i +LdKRuwTf8/8NbROdhVM21An1ZI4nRsUpeFTnh3f/dT5yNyWvN0iFXXhsxLwz2qbnNMBwo1I7 Zj8LnQ18TZRjDYUZCgeR45eMpVjv8ci6V4T+m0qKZtzlJgF9ddI5zYdtp7+RJfuhKP2YPwgYM WCcWPJtuqJwqdI8UQf3cHDhRbtrhzi3UcYaWURXNINhjeId5TP7GqLjCowkYa3dBFuMa3v+at o5/9enAVhBgXv+5ElFYeBya0gx4RRb7cydfpDC3mgU77gMWJ7g9gtiQXxzB9Czm1HRU42NvK/ Vp3PRn1kosvqocOoocrg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The function was removed a long time ago, but the declaration and a dummy implementation are still there, referencing the deprecated time_t type. Remove both. Fixes: f958a1320ff7 ("nfsd4: remove unnecessary lease-setting function") Signed-off-by: Arnd Bergmann --- fs/nfsd/nfsd.h | 2 -- 1 file changed, 2 deletions(-) -- 2.20.0 diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h index 57b93d95fa5c..31f152bbbb2f 100644 --- a/fs/nfsd/nfsd.h +++ b/fs/nfsd/nfsd.h @@ -142,7 +142,6 @@ int nfs4_state_start(void); int nfs4_state_start_net(struct net *net); void nfs4_state_shutdown(void); void nfs4_state_shutdown_net(struct net *net); -void nfs4_reset_lease(time_t leasetime); int nfs4_reset_recoverydir(char *recdir); char * nfs4_recoverydir(void); bool nfsd4_spo_must_allow(struct svc_rqst *rqstp); @@ -153,7 +152,6 @@ static inline int nfs4_state_start(void) { return 0; } static inline int nfs4_state_start_net(struct net *net) { return 0; } static inline void nfs4_state_shutdown(void) { } static inline void nfs4_state_shutdown_net(struct net *net) { } -static inline void nfs4_reset_lease(time_t leasetime) { } static inline int nfs4_reset_recoverydir(char *recdir) { return 0; } static inline char * nfs4_recoverydir(void) {return NULL; } static inline bool nfsd4_spo_must_allow(struct svc_rqst *rqstp)