From patchwork Sat Oct 1 23:41:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9359493 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 30E346075E for ; Sat, 1 Oct 2016 23:42:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C59F28B7F for ; Sat, 1 Oct 2016 23:42:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0051C28BA7; Sat, 1 Oct 2016 23:42:08 +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=-3.7 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9BE1E28B7F for ; Sat, 1 Oct 2016 23:42:08 +0000 (UTC) Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u91NfqH3031908 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 1 Oct 2016 23:41:52 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id u91Nfm0Z030593 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 1 Oct 2016 23:41:48 GMT Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1bqTud-0003yl-VG; Sat, 01 Oct 2016 16:41:47 -0700 Received: from aserv0022.oracle.com ([141.146.126.234]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1bqTuc-0003yc-KT for ocfs2-devel@oss.oracle.com; Sat, 01 Oct 2016 16:41:46 -0700 Received: from aserp1060.oracle.com (aserp1060.oracle.com [141.146.126.71]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id u91Nfkdd030585 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 1 Oct 2016 23:41:46 GMT Received: from userp2040.oracle.com (userp2040.oracle.com [156.151.31.90]) by aserp1060.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u91NfjsT023308 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sat, 1 Oct 2016 23:41:46 GMT Authentication-Results: aserp1060.oracle.com; dkim=pass reason="2048-bit key" header.d=gmail.com header.i=@gmail.com header.b=Dg1vv+uY Received: from pps.filterd (userp2040.oracle.com [127.0.0.1]) by userp2040.oracle.com (8.16.0.17/8.16.0.17) with SMTP id u91NbCdc016992 for ; Sat, 1 Oct 2016 23:41:45 GMT Authentication-Results: oracle.com; spf=pass smtp.mailfrom=deepa.kernel@gmail.com Received: from mail-pa0-f68.google.com (mail-pa0-f68.google.com [209.85.220.68]) by userp2040.oracle.com with ESMTP id 25t3s5we2r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Sat, 01 Oct 2016 23:41:45 +0000 Received: by mail-pa0-f68.google.com with SMTP id oz2so6457316pac.0 for ; Sat, 01 Oct 2016 16:41:45 -0700 (PDT) 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; bh=kcQw4k5accHJ83bXKGtPAgM+ZI3GDc2QINkxypQkznc=; b=S9e2MH7ndHdKXiCOD/icg4kxI24mOpY01qttGG/R0PqhXRFHEQ8mC+uuGLuVwR3gVj fwDfOzdKGVYTeOveUB0qL7AZpHxABwAT5X+Sl/CsKsm1urpi6/t4+hfiMqa6NQhAJVr1 VJpTuHisIz9kyWfF2Yodh5d+1eQA5uu2KDLeB0VDbGYcNMc1kkypsueb6u9HDTqoq7dC FD5bMP29faeUfQPs1CJR32ph1GCLYxbV897vuLLU9KuUH+PnAM4rzKMnnfy9bhcIuRLy 3MJwbGm27IHLHDPCbGjBu37PR+Crd2ebG7DdE1OH8Aw7jb4qDww9xIfe6JAcu1IbaELL WQmg== X-Gm-Message-State: AA6/9Rktc+LCwrfR0DY8jLI3QmSghqpPClnCgRghc/c9JfDJg1Kv/qLCSdQF5i/p0hstCw== X-Received: by 10.66.121.198 with SMTP id lm6mr24522458pab.49.1475365304320; Sat, 01 Oct 2016 16:41:44 -0700 (PDT) Received: from deepa-ubuntu.hsd1.ca.comcast.net ([2601:647:5000:6620:35af:2ada:b4f5:75ba]) by smtp.gmail.com with ESMTPSA id sl9sm37228584pab.22.2016.10.01.16.41.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 01 Oct 2016 16:41:43 -0700 (PDT) From: Deepa Dinamani To: linux-kernel@vger.kernel.org Date: Sat, 1 Oct 2016 16:41:38 -0700 Message-Id: <1475365298-29236-1-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.7.4 X-ServerName: mail-pa0-f68.google.com X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 redirect=_spf.google.com X-Proofpoint-Virus-Version: vendor=nai engine=5800 definitions=8305 signatures=670721 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609280000 definitions=main-1610010437 Cc: y2038@lists.linaro.org, ocfs2-devel@oss.oracle.com, arnd@arndb.de Subject: [Ocfs2-devel] [PATCH] fs: ocfs2: Replace CURRENT_TIME macro X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Source-IP: aserv0022.oracle.com [141.146.126.234] 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: 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 a8f1225..e96ed24 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; /*