From patchwork Wed Jun 20 14:31:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 139351 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp865151lji; Wed, 20 Jun 2018 07:33:03 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL1ZgtBSKwrwzXYtgsoWaP+VgBukyG5FhMFQE+ptw3qwBk7A+DCGUM/GQV7erfahY4OQd/o X-Received: by 2002:a65:6007:: with SMTP id m7-v6mr18428992pgu.92.1529505183339; Wed, 20 Jun 2018 07:33:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529505183; cv=none; d=google.com; s=arc-20160816; b=PtKLG4Ux7zFmYl2YvVNWc2pe4ZdN9mxCLdAOeGsyA3K4W8YihhSlosdCKo8n2gsLV0 37BkQO+bCOyvW9mM9FWKDee/nTJL55i9WqqW+Go4IyygAqiwMZ+lRO7noylKKKxV4dGC 9m4jDzg8K7RJbi9pGLaDtIGEvI05vKk2i6td17NjfHTZxC6StetQ2PQ5paH2OJOgNhXD GZSqydMFiVgSyHFg9nNdIMR/20nFv0HaBPy6Dl+z7f0ahVEC3JnnGaNkSuTkbgFIx2VP gDTkU5pozoQwJmYaKNdTP+xDU5DBCBo+HGWRXlu0zuHrZ/rVrXvkMgCphcEuQuoUTHRk th3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=USVfv3y3ln+04mzo09z+FLukBfBU8Ye68fm4yJIWJQI=; b=AVERpzfES853OVtiXLJBGCYE1N0WLIB/B5ECY624Cdk8jOoVvSBZQW5AtzPDA3jgj2 K0bZ6sdG+yyP8L6B6cDUtrxO3fMGna2/gIGXvLpNUyCI1EK5AdG9asFVMGkzhHyzY65U HCbxiogLzQ8Cm0UUF27HVYkYBUgpeCQ2pEnZw/pPedfnlZHYg1EfrXKqE+3MbeIn4mgO wNg9F/QLtPbDhl0UMW52dLycHd0To/V73TXpWS2XNfiJRfs2V0exBZywaoZxSzMKm54u gID69N8fmohlGtlOoEXrmT6le5En8tDQTPlKG+ZTZ8qN184ireg9xZWI7Hv2/nXLoe3I GugQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7-v6si2027749pgf.484.2018.06.20.07.33.03; Wed, 20 Jun 2018 07:33:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754201AbeFTOdB (ORCPT + 30 others); Wed, 20 Jun 2018 10:33:01 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:50459 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753651AbeFTOc6 (ORCPT ); Wed, 20 Jun 2018 10:32:58 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.129]) with ESMTPA (Nemesis) id 0LcC9p-1fxWBE0ODV-00jbe3; Wed, 20 Jun 2018 16:32:21 +0200 From: Arnd Bergmann To: Jan Kara Cc: y2038@lists.linaro.org, Arnd Bergmann , Dan Williams , Al Viro , Andreas Gruenbacher , "Darrick J. Wong" , "Theodore Ts'o" , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ext2: use ktime_get_real_seconds for timestamps Date: Wed, 20 Jun 2018 16:31:40 +0200 Message-Id: <20180620143203.42225-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K1:zL4mtlEOqtr9Q0vYs1tK9U4Ty4YLduzUOETI8BLVFwW4zHQ8sMj mEARG8mhv+zDQAEOgEQ9MQUmy1E1tu9r39Wm2Zwpr2BMwU5oq491PnQ+85DUrVS6+/6Q1xX Fiu/W27xWQgS38FFljnw6M+7ylOJNwvTzy++dg9jTW3S+IAvaFFi2KG2VYtdhw61LARlMs5 R8dOEr5xCGwmrCdRV2Y1g== X-UI-Out-Filterresults: notjunk:1; V01:K0:2ccxAz5qrY8=:fWCY7dlzBtjyHUJRK7xGE3 CIrLN1tmyP4YL5l/Mk44RCxpxAaB/G9Vy+WUfOA/Uf2uDVGqtOpgdNsOdTvBX5IgLnjToDThu U7Nn7E2/qNB1a+qhYGkd4RoxYIZgRlKGO/LZ+qaVnf2uzHsa/utz/YnhkYeHxy3iN5vTRAwFu Qc9881T6T1f2lDK9BVsAXNPOwEZtsJJ7iAY189LcFq2VmvBaWY+Lj15Zgf/uOe60AiyGbAaNR x9rABlDvL9UU5hs8sr53UTE8nzqlHLKRTKa6/L5gZTRUdynj6DmO1fSr1ire5WSfhK1ZXtXwK SvRpkiP+39MDSV83f0SQtiriX7QdJ7Sg1/CNiG+P2M77KU1anfD0LNW7PWtZGGrNxrBSpAkmI O1yIccGa3weCJflKmQW4fRgI24isECl3GqX1vA7Qijb2YBYggGPtjTmD9OZNEoKbhZPbLe1PQ T0QG9ke4bAzPvE8Yt7/8t2/r2r015VBx8nOauOyc/RDU/nYSzfSgRRBAgtT7o7FxXyYCug9LX KEgLruK/t8KH+R7O+AWAz6RQLrC5gMJDJSxhGrgZbrYUiHNw9ZufM4Y3J5X2Zk3X1+eCxxQTc RAP12ZRQJUE54yQeKijwgCbis6AulhLNLtGDvXXBHBBlz9l/an8X2zKl6obE53mjQa5gjslzd YlANbFSDL693U78/PdRO/tic5kjjIM0uVU5OYEX4OKYihJmqh1U66UwEIVvNNaDyD3jg= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org get_seconds() is deprecated because of the y2038 overflow, so users should migrate to 64-bit timestamps using ktime_get_real_seconds(). In ext2, the timestamps in the superblock and in the inode are all limited to 32-bit, and this won't get fixed, so let's just stop using the deprecated interface and keep truncating. All users of ext2 should migrate to ext4 before 2038 to prevent this from causing problems. Signed-off-by: Arnd Bergmann --- fs/ext2/inode.c | 2 +- fs/ext2/super.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) -- 2.9.0 diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 71635909df3b..7f7ee18fe179 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -86,7 +86,7 @@ void ext2_evict_inode(struct inode * inode) if (want_delete) { sb_start_intwrite(inode->i_sb); /* set dtime */ - EXT2_I(inode)->i_dtime = get_seconds(); + EXT2_I(inode)->i_dtime = ktime_get_real_seconds(); mark_inode_dirty(inode); __ext2_write_inode(inode, inode_needs_sync(inode)); /* truncate to 0 */ diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 25ab1274090f..25e31afe961d 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -679,7 +679,7 @@ static int ext2_setup_super (struct super_block * sb, "running e2fsck is recommended"); else if (le32_to_cpu(es->s_checkinterval) && (le32_to_cpu(es->s_lastcheck) + - le32_to_cpu(es->s_checkinterval) <= get_seconds())) + le32_to_cpu(es->s_checkinterval) <= ktime_get_real_seconds())) ext2_msg(sb, KERN_WARNING, "warning: checktime reached, " "running e2fsck is recommended"); @@ -1245,7 +1245,7 @@ void ext2_sync_super(struct super_block *sb, struct ext2_super_block *es, spin_lock(&EXT2_SB(sb)->s_lock); es->s_free_blocks_count = cpu_to_le32(ext2_count_free_blocks(sb)); es->s_free_inodes_count = cpu_to_le32(ext2_count_free_inodes(sb)); - es->s_wtime = cpu_to_le32(get_seconds()); + es->s_wtime = cpu_to_le32(ktime_get_real_seconds()); /* unlock before we do IO */ spin_unlock(&EXT2_SB(sb)->s_lock); mark_buffer_dirty(EXT2_SB(sb)->s_sbh); @@ -1360,7 +1360,7 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) * the rdonly flag and then mark the partition as valid again. */ es->s_state = cpu_to_le16(sbi->s_mount_state); - es->s_mtime = cpu_to_le32(get_seconds()); + es->s_mtime = cpu_to_le32(ktime_get_real_seconds()); spin_unlock(&sbi->s_lock); err = dquot_suspend(sb, -1);