From patchwork Sat Aug 13 22:48:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9278773 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 9845A60231 for ; Sun, 14 Aug 2016 10:51:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 891EF28A1A for ; Sun, 14 Aug 2016 10:51:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DB6B28A28; Sun, 14 Aug 2016 10:51:25 +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=unavailable 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 0A24528A1A for ; Sun, 14 Aug 2016 10:51:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753234AbcHNKvL (ORCPT ); Sun, 14 Aug 2016 06:51:11 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:33204 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753227AbcHNKvK (ORCPT ); Sun, 14 Aug 2016 06:51:10 -0400 Received: by mail-pa0-f68.google.com with SMTP id vy10so2034844pac.0; Sun, 14 Aug 2016 03:51:10 -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=rc8fyqMqBbzmuYnL/33we4dcJsCZGTHjEzyoX6JxPuY=; b=iEbXI5znuYkiIiKs3Y3vAD/BoFZiQsyvI00zYb1Ixx2U8uc35biEu2pYaK0etVIxQi Hw60SSxkYeVegb9T1/HQG3uJOPXbCjfGl55y0gjaziIcNKE/mQBa0I1AKSatUuK7/RBH KUe12dQLOYl2lL46AUqt0PQyxFVeTTfUW/XUsSz7YW+luewHtD587j87GZAEA0+vVuN4 RoC1MW8hpH2bBTFxg2j85A0HmttQUzgp/abLhduiGLiy6xja3/7yOx7bdsgSeKWvmK2W GMcNmfVp8cq1Ne74N0rgRuVn5xu80SYOHWLqEGKNh8TzECsDTX3NccHafQFS0MX3SLET EOtg== 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=rc8fyqMqBbzmuYnL/33we4dcJsCZGTHjEzyoX6JxPuY=; b=kBloOJ1iqLeFADUDWLcwXKf2RAkX48w0r5Jt8+oAVfRW4FWNkl3YzX2wq6kTKAH+kD wL+7CNPB9CvOYdpt6W6gBye4zK/mu9l84xxyIfDTYHEm6+0t/XndwBhY6dzWLKIBMm3t Kr2fSo6hmFWB5ZY8vhbTL1INSnhnxN8j/TzPsGrrMH/HqXoeTPmIUNeip/eSSORHsbBa 83VKfAdJ/2qY0GSlNEiairneAiLiwUUrBIhcrzg/F+TFH/JfsYXIRtmlNUQPkjXEUOnQ RxVA1QXbtM6d73VJwgA5ijCarh74h2lAgZgv027OijR3zG02SMfZnqBJgjm63W+UOgf2 OcMg== X-Gm-Message-State: AEkoousKXnaYLIBbqpE3iDqg7nsMGolzJb6AL1OuKiT01kWHtKfRT3Qa6tdz5hUp1BDkjw== X-Received: by 10.66.242.166 with SMTP id wr6mr40280146pac.147.1471128576647; Sat, 13 Aug 2016 15:49:36 -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 81sm22528007pfm.90.2016.08.13.15.49.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 13 Aug 2016 15:49:36 -0700 (PDT) From: Deepa Dinamani To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, tglx@linutronix.de, torvalds@linux-foundation.org, tytso@mit.edu, viro@zeniv.linux.org.uk, y2038@lists.linaro.org, Mark Fasheh , Joel Becker , ocfs2-devel@oss.oracle.com Subject: [PATCH v4 18/26] fs: ocfs2: Replace CURRENT_TIME macro Date: Sat, 13 Aug 2016 15:48:30 -0700 Message-Id: <1471128518-24075-19-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1471128518-24075-1-git-send-email-deepa.kernel@gmail.com> References: <1471128518-24075-1-git-send-email-deepa.kernel@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP CURRENT_TIME is not y2038 safe. Use y2038 safe ktime_get_real_seconds() here for timestamps. struct heartbeat_block's hb_seq and deletetion time are already 64 bits wide and accommodate times beyond y2038. Also use y2038 safe ktime_get_real_ts64() for on disk inode timestamps. These are also wide enough to accommodate time64_t. Signed-off-by: Deepa Dinamani Reviewed-by: Arnd Bergmann Cc: Mark Fasheh Cc: Joel Becker Cc: ocfs2-devel@oss.oracle.com --- fs/ocfs2/cluster/heartbeat.c | 2 +- fs/ocfs2/inode.c | 2 +- fs/ocfs2/namei.c | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index 636abcb..9158c98 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c @@ -741,7 +741,7 @@ static inline void o2hb_prepare_block(struct o2hb_region *reg, hb_block = (struct o2hb_disk_heartbeat_block *)slot->ds_raw_block; memset(hb_block, 0, reg->hr_block_bytes); /* TODO: time stuff */ - cputime = CURRENT_TIME.tv_sec; + cputime = ktime_get_real_seconds(); if (!cputime) cputime = 1; diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index c56a767..382401d 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c @@ -703,7 +703,7 @@ static int ocfs2_remove_inode(struct inode *inode, goto bail_commit; } - di->i_dtime = cpu_to_le64(CURRENT_TIME.tv_sec); + di->i_dtime = cpu_to_le64(ktime_get_real_seconds()); di->i_flags &= cpu_to_le32(~(OCFS2_VALID_FL | OCFS2_ORPHANED_FL)); ocfs2_journal_dirty(handle, di_bh); diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index e2747d8..6a7bf9a 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c @@ -516,6 +516,7 @@ static int __ocfs2_mknod_locked(struct inode *dir, struct ocfs2_extent_list *fel; u16 feat; struct ocfs2_inode_info *oi = OCFS2_I(inode); + struct timespec64 ts; *new_fe_bh = NULL; @@ -564,10 +565,11 @@ static int __ocfs2_mknod_locked(struct inode *dir, fe->i_last_eb_blk = 0; strcpy(fe->i_signature, OCFS2_INODE_SIGNATURE); fe->i_flags |= cpu_to_le32(OCFS2_VALID_FL); + ktime_get_real_ts64(&ts); fe->i_atime = fe->i_ctime = fe->i_mtime = - cpu_to_le64(CURRENT_TIME.tv_sec); + cpu_to_le64(ts.tv_sec); fe->i_mtime_nsec = fe->i_ctime_nsec = fe->i_atime_nsec = - cpu_to_le32(CURRENT_TIME.tv_nsec); + cpu_to_le32(ts.tv_nsec); fe->i_dtime = 0; /*