From patchwork Sat Apr 8 19:37:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9671225 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 7DD4B60375 for ; Sat, 8 Apr 2017 19:40:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6FBDE28417 for ; Sat, 8 Apr 2017 19:40:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 557892844B; Sat, 8 Apr 2017 19:40:38 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 DD97528417 for ; Sat, 8 Apr 2017 19:40:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752731AbdDHTj5 (ORCPT ); Sat, 8 Apr 2017 15:39:57 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34279 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752343AbdDHTjO (ORCPT ); Sat, 8 Apr 2017 15:39:14 -0400 Received: by mail-pf0-f194.google.com with SMTP id o126so4569547pfb.1; Sat, 08 Apr 2017 12:39:14 -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=a7t2zhKUM8FQfG+Uz9qnzr3GX8pNgpKeNN9FSPqDXL4=; b=mCO9xuKJqpHFwWX/xSxUtkNeOTi0ghLbeOsTFYsSqKG/DKSHzHO025e1V8IalMIl6z rVrGK9PbmUi/NkQUgY7RL8LlA3Tu88XAhNSJOrntd+11Eoi2csmH3k8NGvppD7at5gcj 2fS4pDQT2/4jTLHSI9TAXtA477mcyt2rDQuGECWmPqMXCwTOst4WF/JJkcNfU5LifFkb VgXqBN8f2UI2vWlydH+MJjDSPO7UOTMXRZGZRZpfnPB9Xy3GRqeL2uNf83ZZVFuTLbve sEVG13cssu9FfFWTtj1OBIOJ1rbMagDL8WhbTfCCUzzZJmPmNqoZMRb1xpyLV21owNKy hFNA== 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=a7t2zhKUM8FQfG+Uz9qnzr3GX8pNgpKeNN9FSPqDXL4=; b=cQSpw3R507si7X8b6r7vkH1iutSCD8dgUuhKMHttvp+4U7TVs78ZtnmIhNstYHAduQ 7ZStrRXcuD7IAugng/bD0bM2zpYo00a1wwP2uLXLxyEQIX6hRt/Hj5iU9LzzYINldD/7 EOnInQvzaTs7+jPIyflFwcYxC9hdYNiu0XqgyKc8HWXtUg0OX3+Pccd/HhqqeRaikyab vdpE1TnL8lvS9dplux11MVDk9Ul9vjtTzSe7sXemmJ9Tfw6zaiOVStBeubVT5zg6OtzM uFUcMT1l3vrB1XHCN+aVCnXFlvSKPjlvgHkYLnPVEhfsdcuyCE6WPNu9UTp5aLBDo73C sdbA== X-Gm-Message-State: AN3rC/6HiEebMqs7g/6XKzV9pfeSPgydSAoNgYviZkvHql9sqM2f+3vER+bXXhd7cNF/Aw== X-Received: by 10.98.76.8 with SMTP id z8mr9303238pfa.14.1491680353458; Sat, 08 Apr 2017 12:39:13 -0700 (PDT) Received: from deepa-ubuntu.hsd1.ca.comcast.net ([2601:647:5000:6620:b9e0:ac:e01a:86f8]) by smtp.gmail.com with ESMTPSA id t12sm16328627pfg.14.2017.04.08.12.39.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 08 Apr 2017 12:39:12 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org Cc: torvalds@linux-foundation.org, tglx@linutronix.de, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org Subject: [PATCH v5 3/5] ext4: Initialize timestamps limits Date: Sat, 8 Apr 2017 12:37:45 -0700 Message-Id: <1491680267-11171-4-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491680267-11171-1-git-send-email-deepa.kernel@gmail.com> References: <1491680267-11171-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 ext4 has different overflow limits for max filesystem timestamps based on the extra bytes available. Signed-off-by: Deepa Dinamani Cc: "Theodore Ts'o" Cc: Andreas Dilger Cc: linux-ext4@vger.kernel.org --- fs/ext4/ext4.h | 4 ++++ fs/ext4/super.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index fb69ee2..3292d4e 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -1640,6 +1640,10 @@ static inline void ext4_clear_state_flags(struct ext4_inode_info *ei) #define EXT4_GOOD_OLD_INODE_SIZE 128 +#define EXT4_EXTRA_TIMESTAMP_MAX (((s64)1 << 34) - 1 + S32_MIN) +#define EXT4_NON_EXTRA_TIMESTAMP_MAX Y2038_EXPIRY_TIMESTAMP +#define EXT4_TIMESTAMP_MIN S32_MIN + /* * Feature set definitions */ diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 73cae0c..0c1a864 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -3687,8 +3687,13 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) sbi->s_inode_size); goto failed_mount; } - if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) + if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) { sb->s_time_gran = 1 << (EXT4_EPOCH_BITS - 2); + sb->s_time_max = EXT4_EXTRA_TIMESTAMP_MAX; + } else + sb->s_time_max = EXT4_NON_EXTRA_TIMESTAMP_MAX; + + sb->s_time_min = EXT4_TIMESTAMP_MIN; } sbi->s_desc_size = le16_to_cpu(es->s_desc_size);