From patchwork Sat Apr 8 00:57:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9670815 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 7BAFA602B3 for ; Sat, 8 Apr 2017 01:02:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D07D285FE for ; Sat, 8 Apr 2017 01:02:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61C0B28633; Sat, 8 Apr 2017 01:02:34 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 096A4285FE for ; Sat, 8 Apr 2017 01:02:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934573AbdDHBBX (ORCPT ); Fri, 7 Apr 2017 21:01:23 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:36135 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933518AbdDHA6t (ORCPT ); Fri, 7 Apr 2017 20:58:49 -0400 Received: by mail-pg0-f67.google.com with SMTP id 81so18669846pgh.3; Fri, 07 Apr 2017 17:58:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Jfpewos1LSTvlu2A5yJli2r5bfJtErznUpxwpzOHImQ=; b=Mo2Y96Fc/aQ6YeEWTEwGePaMTCFP34OrxSHnC3Xm10RxJ/KwOK3iNfhJL8Mn7Ohkop k1XOJRfYoUZG3POZRxDiYeVvp8mQSo392rr6l65Z8jfBPC+TyCFcZArAU3nUuEQOMQxc wNJyq6o1fiKrpG6m3bOr5WLOykILm3nljjjkwKhYZLzbci7AttSM0XWUC02RgXAw6nzF mWc0gmj2np+X48Vb5vEDfRdLlBCqQVoJyTeF7Xg7purxdgPeN4/JecQssEFp07woQYO9 r7+HX+K2H5ycikj3O8ECq1Du5/PhNVhcG4LPUAiylM6Wlv+SLlEj3l/u4EgfnOf1Q6Pg wSMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Jfpewos1LSTvlu2A5yJli2r5bfJtErznUpxwpzOHImQ=; b=TxfpV+eEuQKzoVWZeXrIG18Rf5dKWBoGfFR5aE7s0NK3iSkQYsSToiRD9ALSszCsew xfWCsi73rqL4XDJ8W8kAp0a4hgsVgJKhofJ6wQbz18GaAr+JUsoep9Y3TF//IlaNl7vN 5rC1DED8yQUFzW4LR3jkUXIBSsZNRhpV+dJ8yOH2WB0J6u1kRZr392XI8tck1EDx8KA3 KvFx4P8NZi3K91EW9m6T9D5OyDdHxeMWnskt7bwU1lRdxY0UICqTQfllL7wY56zEczMZ IIwEsvzYk3OQL8s5wvulzkeVcO3DWgdv2azuA7wXihroq32IMWyG9MHr+iMq65vkT0+l PBkQ== X-Gm-Message-State: AFeK/H0Lx+j6gRgp9vb3b0NjJzqeQkxlp58zXy0rY4fjsfpAnpm7d1QQ9q13+KMKkOaAqQ== X-Received: by 10.99.94.66 with SMTP id s63mr42160277pgb.34.1491613127428; Fri, 07 Apr 2017 17:58:47 -0700 (PDT) Received: from deepa-ubuntu.hsd1.ca.comcast.net ([2601:647:5000:6620:95ed:e0d8:7705:f3cc]) by smtp.gmail.com with ESMTPSA id b8sm11638130pfk.39.2017.04.07.17.58.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 07 Apr 2017 17:58:46 -0700 (PDT) From: Deepa Dinamani To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org Cc: tglx@linutronix.de, viro@zeniv.linux.org.uk, gregkh@linuxfoundation.org, andreas.dilger@intel.com, arnd@arndb.de, bfields@fieldses.org, clm@fb.com, davem@davemloft.net, dsterba@suse.com, dushistov@mail.ru, eparis@redhat.com, jaegeuk@kernel.org, jbacik@fb.com, jlayton@poochiereds.net, john.stultz@linaro.org, jsimmons@infradead.org, mingo@redhat.com, oleg.drokin@intel.com, paul@paul-moore.com, rostedt@goodmis.org, yuchao0@huawei.com, ceph-devel@vger.kernel.org, devel@driverdev.osuosl.org, linux-audit@redhat.com, linux-btrfs@vger.kernel.org, linux-cifs@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-security-module@vger.kernel.org, lustre-devel@lists.lustre.org, netdev@vger.kernel.org, samba-technical@lists.samba.org, y2038@lists.linaro.org Subject: [PATCH 09/12] lustre: Replace CURRENT_TIME macro Date: Fri, 7 Apr 2017 17:57:07 -0700 Message-Id: <1491613030-11599-10-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491613030-11599-1-git-send-email-deepa.kernel@gmail.com> References: <1491613030-11599-1-git-send-email-deepa.kernel@gmail.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP CURRENT_TIME macro is not y2038 safe on 32 bit systems. The patch replaces all the uses of CURRENT_TIME by current_time() for filesystem times, and ktime_get_* functions for others. struct timespec is also not y2038 safe. Retain timespec for timestamp representation here as lustre uses it internally everywhere. These references will be changed to use struct timespec64 in a separate patch. This is also in preparation for the patch that transitions vfs timestamps to use 64 bit time and hence make them y2038 safe. current_time() is also planned to be transitioned to y2038 safe behavior along with this change. CURRENT_TIME macro will be deleted before merging the aforementioned change. Signed-off-by: Deepa Dinamani --- drivers/staging/lustre/lustre/llite/llite_lib.c | 6 +++--- drivers/staging/lustre/lustre/osc/osc_io.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 7b80040..2b4b6b9 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -1472,17 +1472,17 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) /* We mark all of the fields "set" so MDS/OST does not re-set them */ if (attr->ia_valid & ATTR_CTIME) { - attr->ia_ctime = CURRENT_TIME; + attr->ia_ctime = current_time(inode); attr->ia_valid |= ATTR_CTIME_SET; } if (!(attr->ia_valid & ATTR_ATIME_SET) && (attr->ia_valid & ATTR_ATIME)) { - attr->ia_atime = CURRENT_TIME; + attr->ia_atime = current_time(inode); attr->ia_valid |= ATTR_ATIME_SET; } if (!(attr->ia_valid & ATTR_MTIME_SET) && (attr->ia_valid & ATTR_MTIME)) { - attr->ia_mtime = CURRENT_TIME; + attr->ia_mtime = current_time(inode); attr->ia_valid |= ATTR_MTIME_SET; } diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index f991bee..cbab800 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -216,7 +216,7 @@ static int osc_io_submit(const struct lu_env *env, struct cl_object *obj = ios->cis_obj; cl_object_attr_lock(obj); - attr->cat_mtime = LTIME_S(CURRENT_TIME); + attr->cat_mtime = ktime_get_real_seconds(); attr->cat_ctime = attr->cat_mtime; cl_object_attr_update(env, obj, attr, CAT_MTIME | CAT_CTIME); cl_object_attr_unlock(obj); @@ -256,7 +256,7 @@ static void osc_page_touch_at(const struct lu_env *env, kms > loi->loi_kms ? "" : "not ", loi->loi_kms, kms, loi->loi_lvb.lvb_size); - attr->cat_ctime = LTIME_S(CURRENT_TIME); + attr->cat_ctime = ktime_get_real_seconds(); attr->cat_mtime = attr->cat_ctime; valid = CAT_MTIME | CAT_CTIME; if (kms > loi->loi_kms) {