From patchwork Wed Jun 20 07:46:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 139301 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp558857lji; Wed, 20 Jun 2018 02:42:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKImzsYgumcF2NVt+1JyaYFOXtALBnQRN0T7bJEbdDMLxe+4z8Q3yVNetC/EqZZmqgX/PL33 X-Received: by 2002:a62:1bc2:: with SMTP id b185-v6mr21996687pfb.225.1529487745469; Wed, 20 Jun 2018 02:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529487745; cv=none; d=google.com; s=arc-20160816; b=crtRRJ7Vw9q+NQIfS7juped9fdfMpjKJzOU69QcmCqAjU04QPVU3ZJR81uT4gjmLeT zmAIIOgbU8M1seIoL28bugXV8HipDz9p5Kl7D1IKU0c76mSTVkOEsq6WrJcxr+KJQiD8 kEGuJOz/Q5mYWfDVpYTJQrsTHPlegsfYXONBSSy2CbbXzKrIqWtqlTqVXynuzgG/OdQk TDk9NeAxwrbv0y4JvD4QQY4AfwBN1lnWisS2QZGkgzfxCe4v0mUAZyCu4TJVviZZFQ2N Qm1IsuL9r+lgPXEcFCLwmGNvdX/8fHRM26bK5VgfSssrmC/OBlVl5UJQgGZWGz/Ks1yz e6VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=AO4JVdQ001BYMA7phJDjDe66fKenRJH+aB6zJ0xVhEs=; b=z1EyvlQvXqsBU4hkQ+efEDGvD0nfTo/t61ajYNHXnog6KU5dbt1cp6fZYNm8kZrC6E mdorI6IfSNQdr9GpbCC77suwnuQ4OZdizYrE1/8WYzzYh1NRGd5+Mc2WC7UsonbFgHoY xEXIim+k57IkqCZynuMCzfVaCrzqyCb88cw/+BGEtsck9A+LdTEhODcHKkdFSy4u14VD LYrup4odoLjAHz6lniJua5/rZoOHBdJc4g48vb0AfRE2msnBwFQMp++iKTcOTOYG0KG8 mVxa8o9+Y7nOgF1+R1e9jS4dah+WzqpHl+ZBm8tZplFg+3BX+bG8QBRRcEow/vbm4X50 d4Mw== 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 t82-v6si2041680pfi.221.2018.06.20.02.42.25; Wed, 20 Jun 2018 02:42:25 -0700 (PDT) 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 S932481AbeFTJmX (ORCPT + 30 others); Wed, 20 Jun 2018 05:42:23 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:53395 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754268AbeFTI3M (ORCPT ); Wed, 20 Jun 2018 04:29:12 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0MgDrd-1ft06H42Uf-00NR5g; Wed, 20 Jun 2018 09:46:49 +0200 From: Arnd Bergmann To: David Howells Cc: y2038@lists.linaro.org, Arnd Bergmann , Anna Schumaker , linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] afs: use a consistent interpretation of time values Date: Wed, 20 Jun 2018 09:46:39 +0200 Message-Id: <20180620074647.4152617-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K1:8tZHIp9wTxGykRLfAAbbBLJ88u93pWA83epIet8NDXC6qTt4dUg MN7LNWjvAifMMu5jFwIMGUbJweZdc9OylxHPSz2nhgxIrjsgkkE0kFxBpWv2lonNaXxWp97 GshLNlhgEPO5OMWypUk8jQSVzoeTlTL0kIGD+Rf+VfSdmBS94KMmt7UcvllVC4hz8nVFng4 ewtYnHIZ09Bqj0uyc8kTg== X-UI-Out-Filterresults: notjunk:1; V01:K0:JqiX6A9JI1A=:OtLeVSNL9DAqFYLSl2huNR By8dCtcOWVi9cvyfbUYflq2XTfWOvgpnbjJcs0MpJxqxVyv91w/k7lzZU8FmERSX3KvBUUW2z M8VJmXEF9qMc28nVUlB8Kp7lJ3rnWkXgUeYuhOPzKG+9cvBbajFNh0/QLaovFirwuyePV+Wji O4ytPPepXU9DuQJaqd3VenDS8CBfjSbN5n47p6cqgWU7s12LYfCJD3e6kNRHDgmP22hkbev8/ dJdoJC5FEYqydzeibpTA8PcW/d3vcxuwllWk6zgJ58zy94O6ajUtwVpjFa0S6WZjQ+DvHQyhJ 7UK+ve6rhurHqxP4b5CaIBQ9THpM5uon3769NKb4Nsqpitp8wbiNDzKemRdm7hB30k6FAgcm2 fmjSfKUl9P1ByP0vufG/AzO6SFLF/vmhemimPxODlbGTaf+naK4JKEdpDAzHTBW7mObqYyWk0 q1MSgbdFqMizv2MUglxXj2Bm7aFx/tactzIeZyWZJpatipUZu7WYrzMBaujbH7thQppoKwWqK 4lKnt7pBMd7xecyPVYx5a+ev8b9lAJb0IkodHZ9FjAOgXg8tXfFN2PlEnujxGVMwao6chNBdn sU6vH9/8rKUWwT1izBJ2uQTsNd4djnVdQT4fW+Ue5IQ6AmpUSQQUZ3p4YmAQcXWqvaF5juHGL tMP1yFQvvk/+tfXIWvh0XM0nehLDofjL6mM5/yDSYcyY/+EPWXEXEqhKyJVSQ8WLo8iY= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org afs uses 32-bit timestamps everywhere, but mixes signed and unsigned usage, which is a bit inconsistent. In particular on 32-bit machines, it currently uses unsigned timestamps (ranging from 1970 to 2106) for locally modified files, but signed timestamps (rand 1902 to 2038) when reading from a remote end. On 64-bit machines, we always interpret timestamps as unsigned here. This replaces the deprecated time_t and get_seconds() interfaces with the modern time64_t and current_time() to locally store 64-bit timestamps, taking care to use unsigned interpretation of the raw values everywhere, which avoids the y2038 overflow and is consistent with the previous usage on 64-bit machines. Signed-off-by: Arnd Bergmann --- fs/afs/afs.h | 6 +++--- fs/afs/inode.c | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) -- 2.9.0 diff --git a/fs/afs/afs.h b/fs/afs/afs.h index b4ff1f7ae4ab..6ca50c293553 100644 --- a/fs/afs/afs.h +++ b/fs/afs/afs.h @@ -129,8 +129,8 @@ typedef u32 afs_access_t; struct afs_file_status { u64 size; /* file size */ afs_dataversion_t data_version; /* current data version */ - time_t mtime_client; /* last time client changed data */ - time_t mtime_server; /* last time server changed data */ + time64_t mtime_client; /* last time client changed data */ + time64_t mtime_server; /* last time server changed data */ unsigned abort_code; /* Abort if bulk-fetching this failed */ afs_file_type_t type; /* file type */ @@ -158,7 +158,7 @@ struct afs_file_status { * AFS volume synchronisation information */ struct afs_volsync { - time_t creation; /* volume creation time */ + time64_t creation; /* volume creation time */ }; /* diff --git a/fs/afs/inode.c b/fs/afs/inode.c index 479b7fdda124..0507e52e3330 100644 --- a/fs/afs/inode.c +++ b/fs/afs/inode.c @@ -213,9 +213,7 @@ struct inode *afs_iget_pseudo_dir(struct super_block *sb, bool root) set_nlink(inode, 2); inode->i_uid = GLOBAL_ROOT_UID; inode->i_gid = GLOBAL_ROOT_GID; - inode->i_ctime.tv_sec = get_seconds(); - inode->i_ctime.tv_nsec = 0; - inode->i_atime = inode->i_mtime = inode->i_ctime; + inode->i_ctime = inode->i_atime = inode->i_mtime = current_time(inode); inode->i_blocks = 0; inode_set_iversion_raw(inode, 0); inode->i_generation = 0;