From patchwork Sat Apr 8 00:56:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9670721 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 D320C60375 for ; Sat, 8 Apr 2017 00:58:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4F00285FE for ; Sat, 8 Apr 2017 00:58:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B48F628639; Sat, 8 Apr 2017 00:58:52 +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=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 64F8128619 for ; Sat, 8 Apr 2017 00:58:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933952AbdDHA6l (ORCPT ); Fri, 7 Apr 2017 20:58:41 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:32826 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933518AbdDHA6b (ORCPT ); Fri, 7 Apr 2017 20:58:31 -0400 Received: by mail-pg0-f68.google.com with SMTP id 79so18684838pgf.0; Fri, 07 Apr 2017 17:58:30 -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=gSP2RL1NKPqOt3qv87pDIOHj/J/Z27GleAKK7rdXFFI=; b=FMDoQhEVHgs7aH2seqpbmBs40ZwFUVdVAUnXF4HcAgk5ojHvI6kwj/aYESTsdkfpaF gjgNZFAw07hqzI1Pw1/Eptd+yxAFiaHmsLBWvsrH6S/iHxZCKvbb4bFqIR8b+tzJqlTC 2O3GBp6F+CdYpLBY7VIaLeoXdeTviBQGGhsSMPymE9wCZxbut7AI1oaH0+74HemCFrFP UgT0OHCeSoTJXqtgy0kjVTxPS384ERtVMkstffc+IwCAV/rryVv7WosqQzb7Euvp4cUC ZTjF7YnIbXuKHoh49bU1f1W/yNCLefdyax/7AX9PPErF2r0sgeSzep0R8qEhftSJ1oRD 76bQ== 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=gSP2RL1NKPqOt3qv87pDIOHj/J/Z27GleAKK7rdXFFI=; b=DuWyLfDJhM7Ztg3K5rJfaWl5goq0RPIRQbdJWruK4vjvHE0Ue6QXbznEJ6Wdos/Q48 BmiMeRH0BVzUnzcqIZy8iT/ZGYKUbRElWNWs1Cc67Ty0z+GtM7l0T/V7BvcupJVjsaeF y2udqvsdHXlYew2J2CtTO0WY/bOdIHJjquXLMwJuHEJdB8eAiwjSJW9iY2SMpsW/G/Bt iWQrU0P9YuKdgZgb+yeZsMw6fErRA0UnVl53sNpZkOD8mHj3NOP1L+HJfOb4JxAGMGjG 93mL/HjTUAS6p4hsfrvZfo3UkncxX4TaGKXPBNGIXvCyTJXmUIsMJ052aCYPFRo4lomj JpCg== X-Gm-Message-State: AFeK/H3EIaAZ6resrNt7nGfhe91X8WsMA4c9s9yDpWySwM2EOn7EBjAhd+ACmbKMHDQ6GA== X-Received: by 10.84.210.132 with SMTP id a4mr13343470pli.40.1491613110277; Fri, 07 Apr 2017 17:58:30 -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.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 07 Apr 2017 17:58:29 -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 01/12] fs: f2fs: Use ktime_get_real_seconds for sit_info times Date: Fri, 7 Apr 2017 17:56:59 -0700 Message-Id: <1491613030-11599-2-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: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP CURRENT_TIME_SEC is not y2038 safe. Replace use of CURRENT_TIME_SEC with ktime_get_real_seconds in segment timestamps used by GC algorithm including the segment mtime timestamps. Signed-off-by: Deepa Dinamani Reviewed-by: Arnd Bergmann --- fs/f2fs/segment.c | 2 +- fs/f2fs/segment.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 010324c..0531500 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -2678,7 +2678,7 @@ static int build_sit_info(struct f2fs_sb_info *sbi) sit_i->dirty_sentries = 0; sit_i->sents_per_block = SIT_ENTRY_PER_BLOCK; sit_i->elapsed_time = le64_to_cpu(sbi->ckpt->elapsed_time); - sit_i->mounted_time = CURRENT_TIME_SEC.tv_sec; + sit_i->mounted_time = ktime_get_real_seconds(); mutex_init(&sit_i->sentry_lock); return 0; } diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 57e36c1..156afc3 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -692,8 +692,9 @@ static inline void set_to_next_sit(struct sit_info *sit_i, unsigned int start) static inline unsigned long long get_mtime(struct f2fs_sb_info *sbi) { struct sit_info *sit_i = SIT_I(sbi); - return sit_i->elapsed_time + CURRENT_TIME_SEC.tv_sec - - sit_i->mounted_time; + time64_t now = ktime_get_real_seconds(); + + return sit_i->elapsed_time + now - sit_i->mounted_time; } static inline void set_summary(struct f2fs_summary *sum, nid_t nid,