From patchwork Mon Nov 11 20:16:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 179144 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp7149069ilf; Mon, 11 Nov 2019 12:22:40 -0800 (PST) X-Google-Smtp-Source: APXvYqzVipxzRfA+zXcp6FJ5LlC4e/hlqAhmqinZb3dELvFWr1FUtfqueFmAHSJsoesuMR1NAN2G X-Received: by 2002:a05:6402:4c5:: with SMTP id n5mr15161610edw.157.1573503760678; Mon, 11 Nov 2019 12:22:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573503760; cv=none; d=google.com; s=arc-20160816; b=m9SnBENy4aWWs8xXsWuUj12fWnqEoBMiYdep1lcSdN5Y+ESemIrsPT+l7PthxMd1Kl aKgegzz8gUZ5Er6uNfx4ongBMyQ8utljKhxfqimybtXxGLgiSEjbOdF7a9B1/mtR5H27 xVAFRg+wUFATXdLlNiO6GtPeCcAFgtDl6pde76+9h77rIWRqgzkNaqRcV0y+nb+UdOud wQMN05SXAjjv1byhTTI0aT+VESWlgqCWpsa8YF4h2TCGnNzPex1RiaW7yRCq8oRnnEN/ b9M7Dnao68Ed0UYZf5CqomzYxwjE2a0EDrsfjL+6JSLYZ8BwXI2ovMq9yCNn9vw4Jc0g Q7kA== 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=yBz3/+ei14FYNylFL9v1rRjcJqjlwyaOkSfPLx6SgaM=; b=ZeUEz0ppCodIhfsDhbwyLwah4obsN3mGexBGR1wIivbV5BXu7uLV5+4/ASoWzBFCLK HOMrItvJSs8cRvNbq0Wb49xm8F+Dc0Z+2m0a8zUwXXq4DefmWKDH31HSWXt0QOf3Teri XAet32J+2yt/yLjmYRnYRfqhZ00NP/m4o6/rvJIzZCKM4vzFZn7k/XdljAcLT33yo47M pGqMLHRJhggzGwqxn3kZymxFCYXYncDbcO0uBGWIP6cYOui3bZrz1rkjC6lULACxKYCN cEIlvU2YQyNn+DvhIISYri1O/f5satYW1OpUPgtkqegi8DIal/PHJ652bSt3vfz4JWkj iMqw== 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 e25si13119864ede.335.2019.11.11.12.22.40; Mon, 11 Nov 2019 12:22: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 S1727915AbfKKUWh (ORCPT + 26 others); Mon, 11 Nov 2019 15:22:37 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:39699 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727341AbfKKUV7 (ORCPT ); Mon, 11 Nov 2019 15:21:59 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MtfVx-1hcRe32Xgl-00v9pY; Mon, 11 Nov 2019 21:16:48 +0100 From: Arnd Bergmann To: linux-nfs@vger.kernel.org, "J. Bruce Fields" , Chuck Lever , Trond Myklebust , Anna Schumaker Cc: y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH 07/19] nfs: encode nfsv4 timestamps as 64-bit Date: Mon, 11 Nov 2019 21:16:27 +0100 Message-Id: <20191111201639.2240623-8-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191111201639.2240623-1-arnd@arndb.de> References: <20191111201639.2240623-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:dtnG94xvD5MjjNlVyWDb5eaSykSgG9mq8dv6e4ANjmnmD4CH84d +nhvBnRu5porjpw0HIFP8ug4gFRLEyIZPisAIuOq9ZMj/rNA+1OYaj1HYy7+4eGlc6Pf9qI 1kNf+O/muQQjPnMZzNDYlMHN4bLVVU2nz/bFzylh1TfhzZyPwf7V+nbOAGjRQj5xXDRrYb+ Sx4obN97lC+jV8jSmnboQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:Xb2NUiu3Utc=:xVTipUWlDL+FBIPGUFolAo seAacejDCYMT+ZhqgGDEceUE+W57sAZZKPKMykwNARU24vZY8ZC1FsBv4cUi2Is3n8hux0ixs odeh1g2FdZbV8pGZdolOF4J0Ca4eDb4gvuqYO7MMVue9dUEYhfQLvcPJohRnhjTKr5r7i7it4 vpY/saUXnzQpJ8TuILGyE7W3f5JAJQyRAdHErgEys3Ukje4EDUiZcf4Cip1dL6LOP1n/zXSQn c3xMNghoxiBhrl4lxLsBYc8019hvCyciYZhNT4QtBP1ZqrKyIl17sVLTA4NO/FzX7j9r50w6n 8lZvs0ZzOt6kLgyCvKHo1LcHQcxVZ7p+gKg0hcTe960/9Bza+2IPYXdscB0KhSFsJ1JKXShMN +n4TPoC7t2+PVUhuI0+FcKHFLGkfoRLUWqZeaSQNceNCgANuQnaTUyAgE2aGJmEJXfGY4NgBM rI7ovIAan2TYM0eVPUmdrR/D3g4f1GBZU2LFx8LD2hcyGkYHYJyZLyd3/fFNDEqQdZslDZXRO Mj+Vw7jyuGyCWb5SmAWj+w3iVwLdsJB1Mk07JhwHa/3E7MXMh24XHSuBXEY34xXv4gat6oPP9 QVK4Dk791/MfJX+ibE5RC13IOu15KCd2qd1vEuVrXJUcGUSjworyO8OFTJR7asIJj3mRksWAF AQgnbJkm0BeAACUg5/Tkn6db2IS4iWmMax4LqJJ4VIV7Vxgo4USdfFcYSd46Ym3lzhXhewFiW W7kxgSPPzKkH67nFMnnlhkhMgyW9c89M5VK/zDzJrS8e9PloSSGfbKUJC0tl0su9pi5AT463L N8nz6E+JwS1f9nT9SgPx7wZK2YuGgpriSe9fLj69YZq4f2yL3Xs5H2ltYZfHBK1k2wkwdkXCl UTwMF3mE7po1hOkWbAdA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 32-bit architectures, xdr_encode_nfstime4() needlessly truncates timestamps to a 32-bit value in the range between year 1902 and 2038. Change it to use 'struct timespec64' to allow the entire range of values supported by the server. Signed-off-by: Arnd Bergmann --- fs/nfs/nfs4xdr.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) -- 2.20.0 diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index c917fb24c56f..a5737f0bac4d 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -1059,9 +1059,9 @@ static void encode_nfs4_verifier(struct xdr_stream *xdr, const nfs4_verifier *ve } static __be32 * -xdr_encode_nfstime4(__be32 *p, const struct timespec *t) +xdr_encode_nfstime4(__be32 *p, const struct timespec64 *t) { - p = xdr_encode_hyper(p, (__s64)t->tv_sec); + p = xdr_encode_hyper(p, t->tv_sec); *p++ = cpu_to_be32(t->tv_nsec); return p; } @@ -1072,7 +1072,6 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const struct nfs_server *server, const uint32_t attrmask[]) { - struct timespec ts; char owner_name[IDMAP_NAMESZ]; char owner_group[IDMAP_NAMESZ]; int owner_namelen = 0; @@ -1161,16 +1160,14 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, if (bmval[1] & FATTR4_WORD1_TIME_ACCESS_SET) { if (iap->ia_valid & ATTR_ATIME_SET) { *p++ = cpu_to_be32(NFS4_SET_TO_CLIENT_TIME); - ts = timespec64_to_timespec(iap->ia_atime); - p = xdr_encode_nfstime4(p, &ts); + p = xdr_encode_nfstime4(p, &iap->ia_atime); } else *p++ = cpu_to_be32(NFS4_SET_TO_SERVER_TIME); } if (bmval[1] & FATTR4_WORD1_TIME_MODIFY_SET) { if (iap->ia_valid & ATTR_MTIME_SET) { *p++ = cpu_to_be32(NFS4_SET_TO_CLIENT_TIME); - ts = timespec64_to_timespec(iap->ia_mtime); - p = xdr_encode_nfstime4(p, &ts); + p = xdr_encode_nfstime4(p, &iap->ia_mtime); } else *p++ = cpu_to_be32(NFS4_SET_TO_SERVER_TIME); }