From patchwork Thu Jun 9 05:05:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9166271 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D300B60467 for ; Thu, 9 Jun 2016 05:10:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C53A126490 for ; Thu, 9 Jun 2016 05:10:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B9C9C28294; Thu, 9 Jun 2016 05:10:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3EEBC26490 for ; Thu, 9 Jun 2016 05:10:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1945980AbcFIFHh (ORCPT ); Thu, 9 Jun 2016 01:07:37 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33895 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1426571AbcFIFGI (ORCPT ); Thu, 9 Jun 2016 01:06:08 -0400 Received: by mail-pf0-f194.google.com with SMTP id 66so202866pfy.1; Wed, 08 Jun 2016 22:06:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1rJ85jRL3S0FqapoUz9INxE7UdBrVWaGNa0P38xAkcY=; b=LO/67NR90JaBKrMaOvZz6fk28B8JQsNqAIL8z6op3aaWOd+WJSApDkgEMiXSIwOSDF EIx6Liv9+y0fsfxSVnbFwmE75se6ykR1d818sxH0Jz30vSH++XC8Q+xkWUZ4tipc+Xtx 7GzrkO11AtC3rleHvAWAy6vg7ohpwTEiMM0aisTnSuO4PGDxVxwTAmS1XglhQGErSkDH 2gVjlFSWTg8L50ZXy1ke8oMj5pmsSu+bOtG2N+DlIeaKKD8yKcXMjltW9UZk1of3UbpB C3hIh2VE7fdiLScE/ffqlDRpgC95BCZZPuuAU/L6oSnO52yiuY6cQ7beJxwi6eCSp8dN M+5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1rJ85jRL3S0FqapoUz9INxE7UdBrVWaGNa0P38xAkcY=; b=SUZNQc6uY4EeXvULyTksZ3nBwXeMdUOyLKo+6xuLDaREBFlYQhVE00952xrE2NweDt Z0K/dYzDLe693A7p12ezq6/dJ98kdRYFtctJ2kEul6214fEGfOPB1mOVLQMhuPQ7oEge a1LNZ5tCkMwEhly+2tFIongllzNDmL7OcFfqvygHcKyb4B4VZ1m2okOBG/pa/uPZSvml kuoa/25CyKUII5CG3luUXyhBUS+8panx11eemt3aUwyMBjwi6a10PFdWcxdLUG3vBOLr u5M44tPKPj7mK/h6BKbGogP+BXaodEaTZCrXuAJJlZqFEbkIDvoptyueayFBDBY+/8to u4nA== X-Gm-Message-State: ALyK8tLIZvyfpPJFlJuPFET1PXjKc7fn6rQp0In6pditZIoRVVMwlCJqwJmYFZbOW0MCoQ== X-Received: by 10.98.70.11 with SMTP id t11mr2607785pfa.16.1465448761338; Wed, 08 Jun 2016 22:06:01 -0700 (PDT) Received: from deepa-ubuntu.hsd1.ca.comcast.net (c-73-252-251-201.hsd1.ca.comcast.net. [73.252.251.201]) by smtp.gmail.com with ESMTPSA id 129sm6220808pfe.3.2016.06.08.22.06.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jun 2016 22:06:00 -0700 (PDT) From: Deepa Dinamani To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Thomas Gleixner , Al Viro , Linus Torvalds , y2038@lists.linaro.org, Trond Myklebust , Anna Schumaker , linux-nfs@vger.kernel.org Subject: [PATCH 18/21] fs: nfs: Make nfs boot time y2038 safe Date: Wed, 8 Jun 2016 22:05:02 -0700 Message-Id: <1465448705-25055-19-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465448705-25055-1-git-send-email-deepa.kernel@gmail.com> References: <1465448705-25055-1-git-send-email-deepa.kernel@gmail.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP boot_time is represented as a struct timespec. struct timespec and CURRENT_TIME are not y2038 safe. Overall, the plan is to use timespec64 for all internal kernel representation of timestamps. CURRENT_TIME will also be removed. Use struct timespec64 to represent boot_time. And, ktime_get_real_ts64() for the boot_time value. boot_time is used to construct the nfs client boot verifier. This will now wrap in 2106 instead of 2038 on 32-bit systems. The server only relies on the value being persistent until reboot so the wrapping should be fine. Signed-off-by: Deepa Dinamani Cc: Trond Myklebust Cc: Anna Schumaker Cc: linux-nfs@vger.kernel.org --- fs/nfs/client.c | 2 +- fs/nfs/netns.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 0c96528..406972e 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -1080,7 +1080,7 @@ void nfs_clients_init(struct net *net) idr_init(&nn->cb_ident_idr); #endif spin_lock_init(&nn->nfs_client_lock); - nn->boot_time = CURRENT_TIME; + ktime_get_real_ts64(&nn->boot_time); } #ifdef CONFIG_PROC_FS diff --git a/fs/nfs/netns.h b/fs/nfs/netns.h index f0e06e4..48d6b95 100644 --- a/fs/nfs/netns.h +++ b/fs/nfs/netns.h @@ -29,7 +29,7 @@ struct nfs_net { int cb_users[NFS4_MAX_MINOR_VERSION + 1]; #endif spinlock_t nfs_client_lock; - struct timespec boot_time; + struct timespec64 boot_time; #ifdef CONFIG_PROC_FS struct proc_dir_entry *proc_nfsfs; #endif