From patchwork Tue Jul 30 01:49:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11064769 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B8AEF746 for ; Tue, 30 Jul 2019 01:50:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9B8328600 for ; Tue, 30 Jul 2019 01:50:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E1D728714; Tue, 30 Jul 2019 01:50:10 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 4435528600 for ; Tue, 30 Jul 2019 01:50:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730767AbfG3Bt4 (ORCPT ); Mon, 29 Jul 2019 21:49:56 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:37621 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730747AbfG3Bt4 (ORCPT ); Mon, 29 Jul 2019 21:49:56 -0400 Received: by mail-pg1-f193.google.com with SMTP id i70so18423536pgd.4; Mon, 29 Jul 2019 18:49:55 -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=V4wnsfYPepTL7VBOARGQ5lE67wVPMfBHpDaxjDrhUgM=; b=mVdhesQ5tNEtX68BtA01z6uL9oklDDFPLHcdyLXmewL2G4JMAlvC3Eoxkfa9wfAtLn hiIaDaFDX2XbDozc5yxoEv50CHGrstA6AfHc87jWXVa2DjUe3vodAws1Cu1zELgQzmhH 1wfGKeH3BAF6Mw0lGuy5kiW85z+yDR7tuIq/OMfAOh9nVh8us5pbq2r6EFiZQtSC1Etj 4e0ECOXlx/Z2ZAhsqxi1MW77jCXGkDFzXBcpUQ1Oy9ig5X2acoaKEeyHZQAo82BiVuqT YAD1Jdx9uHgNqcZFzJ4Zo7Ed/Druaq8pjr+vqRwhCExYwhhVttP3ynRpDHoe1HFVY2xk FYiQ== 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=V4wnsfYPepTL7VBOARGQ5lE67wVPMfBHpDaxjDrhUgM=; b=IsMKdLArXVkRJCYbMjlol8r3dbVBy5VI+oyKg/5LUZRueu8SEl7jWdn5Xc/tXM+q0J e3JMyoICWJa7l6vRzM7Hdiuns+3KSSvD7hYxf7xpzUyBpxAZDYXdFeK/zhmqfeDkrhxt f0D0y1U/5g62O1d/hA9QC+1+0irw1mfjSh9fA+EUWsqaOK8T2ZuI2ZCr1vYqnGHKn8sC AR662yEtaG93+8cT853GUv0LZG81V6+iIxOTCI1n8Ud7qTnpUFmUI4dWcaRdJSbvm+uJ ZMgGMlNFd1QWpWnY/d37oUDa0ou9aml65DTRAYC3KgSNJ9Iu0ztm8BPvwXso01O5myuv Q5eA== X-Gm-Message-State: APjAAAUKwaGIEpPWNVoofV3okLm8Hy5cfcSL1YXNWp5kc4pPnxpW4IGV lYj8cj6UIGD3WyauRyyKLAA= X-Google-Smtp-Source: APXvYqwOOY3NE1Y6XzD7xAqTtYd6ktSggeGAcDfSNL+1v5GlW484jITFkK4C+CN26zJOQTOzp9qUow== X-Received: by 2002:a62:b408:: with SMTP id h8mr38574910pfn.46.1564451395352; Mon, 29 Jul 2019 18:49:55 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id r6sm138807156pjb.22.2019.07.29.18.49.54 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 18:49:54 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org Subject: [PATCH 01/20] vfs: Add file timestamp range support Date: Mon, 29 Jul 2019 18:49:05 -0700 Message-Id: <20190730014924.2193-2-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190730014924.2193-1-deepa.kernel@gmail.com> References: <20190730014924.2193-1-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 Add fields to the superblock to track the min and max timestamps supported by filesystems. Initially, when a superblock is allocated, initialize it to the max and min values the fields can hold. Individual filesystems override these to match their actual limits. Pseudo filesystems are assumed to always support the min and max allowable values for the fields. Signed-off-by: Deepa Dinamani --- fs/super.c | 2 ++ include/linux/fs.h | 3 +++ include/linux/time64.h | 2 ++ 3 files changed, 7 insertions(+) diff --git a/fs/super.c b/fs/super.c index 2739f57515f8..e5835c38d336 100644 --- a/fs/super.c +++ b/fs/super.c @@ -257,6 +257,8 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags, s->s_maxbytes = MAX_NON_LFS; s->s_op = &default_op; s->s_time_gran = 1000000000; + s->s_time_min = TIME64_MIN; + s->s_time_max = TIME64_MAX; s->cleancache_poolid = CLEANCACHE_NO_POOL; s->s_shrink.seeks = DEFAULT_SEEKS; diff --git a/include/linux/fs.h b/include/linux/fs.h index f1a6ca872943..e9d04e4e5628 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1448,6 +1448,9 @@ struct super_block { /* Granularity of c/m/atime in ns (cannot be worse than a second) */ u32 s_time_gran; + /* Time limits for c/m/atime in seconds */ + time64_t s_time_min; + time64_t s_time_max; #ifdef CONFIG_FSNOTIFY __u32 s_fsnotify_mask; struct fsnotify_mark_connector __rcu *s_fsnotify_marks; diff --git a/include/linux/time64.h b/include/linux/time64.h index a620ee610b9f..19125489ae94 100644 --- a/include/linux/time64.h +++ b/include/linux/time64.h @@ -30,6 +30,8 @@ struct itimerspec64 { /* Located here for timespec[64]_valid_strict */ #define TIME64_MAX ((s64)~((u64)1 << 63)) +#define TIME64_MIN (-TIME64_MAX - 1) + #define KTIME_MAX ((s64)~((u64)1 << 63)) #define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) From patchwork Tue Jul 30 01:49:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11064767 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0E85C112C for ; Tue, 30 Jul 2019 01:50:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0C5228600 for ; Tue, 30 Jul 2019 01:50:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1CC328714; Tue, 30 Jul 2019 01:50: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 82BB728600 for ; Tue, 30 Jul 2019 01:50:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730794AbfG3BuE (ORCPT ); Mon, 29 Jul 2019 21:50:04 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:36533 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730780AbfG3Bt7 (ORCPT ); Mon, 29 Jul 2019 21:49:59 -0400 Received: by mail-pg1-f196.google.com with SMTP id l21so29163037pgm.3; Mon, 29 Jul 2019 18:49:59 -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=xC2OMhdvxaLcA9We7nJNC9uJnugsrezxvB9jzWvgvfs=; b=ZJ/pOTcX70i3pJxOfMJ0R187ZTJcXEXsQOkZLMvoUDkHfEzOQD0CbPWvV6rIQSQso/ J/4DvvhcXqcFuvNZ0QIE3LCvefC42aYyCRlJOylUU7na5VdgFiDnUZjn0QekEuHMUYzB FvIR7w48Y3O3lfURiBHAcS20jIE8rH1eE03AuDGI6g63Zhuky1g0wWAs4EpjHU42BKUd gNFCefrxVGaQ6oBI0uGmP1vD/mcPIS3rSCRNVGnJxtwyV7WB1++jAmiwHWxQx1567OdQ NaWwVs1Zbr9Jdzjr3gasypWX2zMNphChaearxJf7PNHKGut45z0UsUGtAWOJ1B8/YJP/ L+HA== 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=xC2OMhdvxaLcA9We7nJNC9uJnugsrezxvB9jzWvgvfs=; b=nOrnNGEFQwlukfnC1zkbf8cWEFDNnpj0eaYtxGujicdZmeTIN/02bX5L+bX0e43wuG tkqR6DjN2QlXCLJHtHPZSv76eoHx+/gmjKN4EPvHBxKp9sXwNiPQku4OfLU8rFNhkOiJ qp0E97FAgiOnn9FBHGO9xORZF7CJcQmwfudhwuyYt4YD5ZAzZ/0LaJ7b7/ldb0V6DBfW Z7GyD0qm6KVS71lFT1xNvSBYIDeVRKjvVc6N5wE2u6FBq0uG2iJsY+2SXqtFDOFTSrFN 9S0Cn7oIIdLTAdAfq4XOuYuuxjI1OnGzL4JqjGnl6CKfPcIO9u+OERFo/Iy383Sc7LZm L+iw== X-Gm-Message-State: APjAAAVkEyneJcgbh3OfbMrznkiI0rtYLnnmjJ26IKa6sM1mrQ/V5xYa VhWsXYHVk9SlMaA9wYCffH4= X-Google-Smtp-Source: APXvYqwjN90VyCjAvq+0tZfhUxx2OyOgUKS5+4BbB5flOCXXyElRWY0uJnx0fdtJok+5LyYc/20JQg== X-Received: by 2002:a63:f13:: with SMTP id e19mr106525919pgl.132.1564451399146; Mon, 29 Jul 2019 18:49:59 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id r6sm138807156pjb.22.2019.07.29.18.49.58 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 18:49:58 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org Subject: [PATCH 02/20] vfs: Add timestamp_truncate() api Date: Mon, 29 Jul 2019 18:49:06 -0700 Message-Id: <20190730014924.2193-3-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190730014924.2193-1-deepa.kernel@gmail.com> References: <20190730014924.2193-1-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 timespec_trunc() function is used to truncate a filesystem timestamp to the right granularity. But, the function does not clamp tv_sec part of the timestamps according to the filesystem timestamp limits. The replacement api: timestamp_truncate() also alters the signature of the function to accommodate filesystem timestamp clamping according to flesystem limits. Note that the tv_nsec part is set to 0 if tv_sec is not within the range supported for the filesystem. Signed-off-by: Deepa Dinamani --- fs/inode.c | 33 ++++++++++++++++++++++++++++++++- include/linux/fs.h | 2 ++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/fs/inode.c b/fs/inode.c index 5f5431ec3d62..0fb1f0fb296a 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -2166,6 +2166,37 @@ struct timespec64 timespec64_trunc(struct timespec64 t, unsigned gran) } EXPORT_SYMBOL(timespec64_trunc); +/** + * timestamp_truncate - Truncate timespec to a granularity + * @t: Timespec + * @inode: inode being updated + * + * Truncate a timespec to the granularity supported by the fs + * containing the inode. Always rounds down. gran must + * not be 0 nor greater than a second (NSEC_PER_SEC, or 10^9 ns). + */ +struct timespec64 timestamp_truncate(struct timespec64 t, struct inode *inode) +{ + struct super_block *sb = inode->i_sb; + unsigned int gran = sb->s_time_gran; + + t.tv_sec = clamp(t.tv_sec, sb->s_time_min, sb->s_time_max); + if (unlikely(t.tv_sec == sb->s_time_max || t.tv_sec == sb->s_time_min)) + t.tv_nsec = 0; + + /* Avoid division in the common cases 1 ns and 1 s. */ + if (gran == 1) + ; /* nothing */ + else if (gran == NSEC_PER_SEC) + t.tv_nsec = 0; + else if (gran > 1 && gran < NSEC_PER_SEC) + t.tv_nsec -= t.tv_nsec % gran; + else + WARN(1, "invalid file time granularity: %u", gran); + return t; +} +EXPORT_SYMBOL(timestamp_truncate); + /** * current_time - Return FS time * @inode: inode. @@ -2187,6 +2218,6 @@ struct timespec64 current_time(struct inode *inode) return now; } - return timespec64_trunc(now, inode->i_sb->s_time_gran); + return timestamp_truncate(now, inode); } EXPORT_SYMBOL(current_time); diff --git a/include/linux/fs.h b/include/linux/fs.h index e9d04e4e5628..fdfe51d096fa 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -726,6 +726,8 @@ struct inode { void *i_private; /* fs or device private pointer */ } __randomize_layout; +struct timespec64 timestamp_truncate(struct timespec64 t, struct inode *inode); + static inline unsigned int i_blocksize(const struct inode *node) { return (1 << node->i_blkbits); From patchwork Tue Jul 30 01:49:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11064771 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 24246746 for ; Tue, 30 Jul 2019 01:50:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12D5F28600 for ; Tue, 30 Jul 2019 01:50:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0613828714; Tue, 30 Jul 2019 01:50:17 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 4D65A28600 for ; Tue, 30 Jul 2019 01:50:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730806AbfG3BuP (ORCPT ); Mon, 29 Jul 2019 21:50:15 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:42081 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730780AbfG3BuP (ORCPT ); Mon, 29 Jul 2019 21:50:15 -0400 Received: by mail-pg1-f193.google.com with SMTP id t132so29155270pgb.9; Mon, 29 Jul 2019 18:50:15 -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=L/HD57pd50ajIUsHODxhnXGWHejzLDOdwJEP3n72SQw=; b=QHhbTm1TZgOm6WvfrheJvUVNeDXD58E3pX5WUEvt1BP91bmPiq5Zxlwe0W7TOYXoCN MkNfx9qLLj8fyaP3b7IF4i6G6Mkgb23PHdlgaNIJRlu3NM6Es13SefEmhkB3J1UfIWGK soB7NWNFa20U8NYgNzlRF3WMC88RtL7qe0bTbQ1cvIhorC2b8kqE/RY85zKTkCEyBsQh BdKev0yI9rY4xF4cPnJ6NS8ZwaRWLLgKzkuAdtPNzcv+sltC90b1jYaaBMcLW3gtpjT0 lcILku6POE4fQfSb3rTDmKTDv0Qjk9tMvj5rB3uc2hsoyfEIeJojb/BRzbD01DDJWzF+ eymA== 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=L/HD57pd50ajIUsHODxhnXGWHejzLDOdwJEP3n72SQw=; b=YzRX245zKwrpmiC8BjRA6gw0c5ekbiCgFAFfjBzA8vh+BXXFL1Fb/RSQGOVo0TSjtg aqAO+cnH/aGEe0bsGt93cokZZ7igb+56qYSDzHk9f1cPVsaDYdrN53OeTX+rYRgRfqM6 QvFh8HgYcl578MWQrbFOYfXNKeDLyvgTBVy8hf/UdqjLJfH5yyhn50mBKLQAg1g/cIac iwPLZpb2PzPM1Adx3RAzav0M4kaXy+Cf3ahVOX1/sTHYRQHYFaP0KArcH0hYv2CMMyDI apJwgPV3CKNfiw5RWF0mZ0GISpBel33MuHpg3L7e+mhAQQeXWki66vqIorRofL/PI6nU JVcA== X-Gm-Message-State: APjAAAVZvNW3G/bSmSMo7SIfupuicUM8IWxTGL/ObdHd4oPETcN6jxyc cGT7TBsnbSPXQT5v8GLiris= X-Google-Smtp-Source: APXvYqymlfxXZkLKDbtTqqG4gNF0mEEFbRBNU2budVpRI6cIsHbCtGHUYAgZi7Jxv18tF300c570QQ== X-Received: by 2002:a17:90a:bd0b:: with SMTP id y11mr109382806pjr.141.1564451414701; Mon, 29 Jul 2019 18:50:14 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id r6sm138807156pjb.22.2019.07.29.18.50.13 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 18:50:14 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org, adrian.hunter@intel.com, anton@tuxera.com, dedekind1@gmail.com, gregkh@linuxfoundation.org, hch@lst.de, hirofumi@mail.parknet.co.jp, jaegeuk@kernel.org, jlbec@evilplan.org, richard@nod.at, tj@kernel.org, yuchao0@huawei.com, linux-f2fs-devel@lists.sourceforge.net, linux-ntfs-dev@lists.sourceforge.net, linux-mtd@lists.infradead.org Subject: [PATCH 03/20] timestamp_truncate: Replace users of timespec64_trunc Date: Mon, 29 Jul 2019 18:49:07 -0700 Message-Id: <20190730014924.2193-4-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190730014924.2193-1-deepa.kernel@gmail.com> References: <20190730014924.2193-1-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 Update the inode timestamp updates to use timestamp_truncate() instead of timespec64_trunc(). The change was mostly generated by the following coccinelle script. virtual context virtual patch @r1 depends on patch forall@ struct inode *inode; identifier i_xtime =~ "^i_[acm]time$"; expression e; @@ inode->i_xtime = - timespec64_trunc( + timestamp_truncate( ..., - e); + inode); Signed-off-by: Deepa Dinamani Cc: adrian.hunter@intel.com Cc: anton@tuxera.com Cc: dedekind1@gmail.com Cc: gregkh@linuxfoundation.org Cc: hch@lst.de Cc: hirofumi@mail.parknet.co.jp Cc: jaegeuk@kernel.org Cc: jlbec@evilplan.org Cc: richard@nod.at Cc: tj@kernel.org Cc: yuchao0@huawei.com Cc: linux-f2fs-devel@lists.sourceforge.net Cc: linux-ntfs-dev@lists.sourceforge.net Cc: linux-mtd@lists.infradead.org --- fs/attr.c | 21 ++++++++++++--------- fs/configfs/inode.c | 12 ++++++------ fs/f2fs/file.c | 21 ++++++++++++--------- fs/fat/misc.c | 5 +++-- fs/kernfs/inode.c | 6 +++--- fs/ntfs/inode.c | 21 ++++++++++++--------- fs/ubifs/file.c | 21 ++++++++++++--------- 7 files changed, 60 insertions(+), 47 deletions(-) diff --git a/fs/attr.c b/fs/attr.c index d22e8187477f..df28035aa23e 100644 --- a/fs/attr.c +++ b/fs/attr.c @@ -183,15 +183,18 @@ void setattr_copy(struct inode *inode, const struct iattr *attr) inode->i_uid = attr->ia_uid; if (ia_valid & ATTR_GID) inode->i_gid = attr->ia_gid; - if (ia_valid & ATTR_ATIME) - inode->i_atime = timespec64_trunc(attr->ia_atime, - inode->i_sb->s_time_gran); - if (ia_valid & ATTR_MTIME) - inode->i_mtime = timespec64_trunc(attr->ia_mtime, - inode->i_sb->s_time_gran); - if (ia_valid & ATTR_CTIME) - inode->i_ctime = timespec64_trunc(attr->ia_ctime, - inode->i_sb->s_time_gran); + if (ia_valid & ATTR_ATIME) { + inode->i_atime = timestamp_truncate(attr->ia_atime, + inode); + } + if (ia_valid & ATTR_MTIME) { + inode->i_mtime = timestamp_truncate(attr->ia_mtime, + inode); + } + if (ia_valid & ATTR_CTIME) { + inode->i_ctime = timestamp_truncate(attr->ia_ctime, + inode); + } if (ia_valid & ATTR_MODE) { umode_t mode = attr->ia_mode; diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c index ab0284321912..884dcf06cfbe 100644 --- a/fs/configfs/inode.c +++ b/fs/configfs/inode.c @@ -76,14 +76,14 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr) if (ia_valid & ATTR_GID) sd_iattr->ia_gid = iattr->ia_gid; if (ia_valid & ATTR_ATIME) - sd_iattr->ia_atime = timespec64_trunc(iattr->ia_atime, - inode->i_sb->s_time_gran); + sd_iattr->ia_atime = timestamp_truncate(iattr->ia_atime, + inode); if (ia_valid & ATTR_MTIME) - sd_iattr->ia_mtime = timespec64_trunc(iattr->ia_mtime, - inode->i_sb->s_time_gran); + sd_iattr->ia_mtime = timestamp_truncate(iattr->ia_mtime, + inode); if (ia_valid & ATTR_CTIME) - sd_iattr->ia_ctime = timespec64_trunc(iattr->ia_ctime, - inode->i_sb->s_time_gran); + sd_iattr->ia_ctime = timestamp_truncate(iattr->ia_ctime, + inode); if (ia_valid & ATTR_MODE) { umode_t mode = iattr->ia_mode; diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 45b45f37d347..faf1e160961b 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -744,15 +744,18 @@ static void __setattr_copy(struct inode *inode, const struct iattr *attr) inode->i_uid = attr->ia_uid; if (ia_valid & ATTR_GID) inode->i_gid = attr->ia_gid; - if (ia_valid & ATTR_ATIME) - inode->i_atime = timespec64_trunc(attr->ia_atime, - inode->i_sb->s_time_gran); - if (ia_valid & ATTR_MTIME) - inode->i_mtime = timespec64_trunc(attr->ia_mtime, - inode->i_sb->s_time_gran); - if (ia_valid & ATTR_CTIME) - inode->i_ctime = timespec64_trunc(attr->ia_ctime, - inode->i_sb->s_time_gran); + if (ia_valid & ATTR_ATIME) { + inode->i_atime = timestamp_truncate(attr->ia_atime, + inode); + } + if (ia_valid & ATTR_MTIME) { + inode->i_mtime = timestamp_truncate(attr->ia_mtime, + inode); + } + if (ia_valid & ATTR_CTIME) { + inode->i_ctime = timestamp_truncate(attr->ia_ctime, + inode); + } if (ia_valid & ATTR_MODE) { umode_t mode = attr->ia_mode; diff --git a/fs/fat/misc.c b/fs/fat/misc.c index 1e08bd54c5fb..53bb7c6bf993 100644 --- a/fs/fat/misc.c +++ b/fs/fat/misc.c @@ -307,8 +307,9 @@ int fat_truncate_time(struct inode *inode, struct timespec64 *now, int flags) inode->i_atime = (struct timespec64){ seconds, 0 }; } if (flags & S_CTIME) { - if (sbi->options.isvfat) - inode->i_ctime = timespec64_trunc(*now, 10000000); + if (sbi->options.isvfat) { + inode->i_ctime = timestamp_truncate(*now, inode); + } else inode->i_ctime = fat_timespec64_trunc_2secs(*now); } diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c index f3f3984cce80..892a58cfe7a1 100644 --- a/fs/kernfs/inode.c +++ b/fs/kernfs/inode.c @@ -161,9 +161,9 @@ static inline void set_inode_attr(struct inode *inode, struct super_block *sb = inode->i_sb; inode->i_uid = attrs->ia_uid; inode->i_gid = attrs->ia_gid; - inode->i_atime = timespec64_trunc(attrs->ia_atime, sb->s_time_gran); - inode->i_mtime = timespec64_trunc(attrs->ia_mtime, sb->s_time_gran); - inode->i_ctime = timespec64_trunc(attrs->ia_ctime, sb->s_time_gran); + inode->i_atime = timestamp_truncate(attrs->ia_atime, inode); + inode->i_mtime = timestamp_truncate(attrs->ia_mtime, inode); + inode->i_ctime = timestamp_truncate(attrs->ia_ctime, inode); } static void kernfs_refresh_inode(struct kernfs_node *kn, struct inode *inode) diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c index 8baa34baf548..6c7388430ad3 100644 --- a/fs/ntfs/inode.c +++ b/fs/ntfs/inode.c @@ -2899,15 +2899,18 @@ int ntfs_setattr(struct dentry *dentry, struct iattr *attr) ia_valid |= ATTR_MTIME | ATTR_CTIME; } } - if (ia_valid & ATTR_ATIME) - vi->i_atime = timespec64_trunc(attr->ia_atime, - vi->i_sb->s_time_gran); - if (ia_valid & ATTR_MTIME) - vi->i_mtime = timespec64_trunc(attr->ia_mtime, - vi->i_sb->s_time_gran); - if (ia_valid & ATTR_CTIME) - vi->i_ctime = timespec64_trunc(attr->ia_ctime, - vi->i_sb->s_time_gran); + if (ia_valid & ATTR_ATIME) { + vi->i_atime = timestamp_truncate(attr->ia_atime, + vi); + } + if (ia_valid & ATTR_MTIME) { + vi->i_mtime = timestamp_truncate(attr->ia_mtime, + vi); + } + if (ia_valid & ATTR_CTIME) { + vi->i_ctime = timestamp_truncate(attr->ia_ctime, + vi); + } mark_inode_dirty(vi); out: return err; diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 400970d740bb..cd52585c8f4f 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -1078,15 +1078,18 @@ static void do_attr_changes(struct inode *inode, const struct iattr *attr) inode->i_uid = attr->ia_uid; if (attr->ia_valid & ATTR_GID) inode->i_gid = attr->ia_gid; - if (attr->ia_valid & ATTR_ATIME) - inode->i_atime = timespec64_trunc(attr->ia_atime, - inode->i_sb->s_time_gran); - if (attr->ia_valid & ATTR_MTIME) - inode->i_mtime = timespec64_trunc(attr->ia_mtime, - inode->i_sb->s_time_gran); - if (attr->ia_valid & ATTR_CTIME) - inode->i_ctime = timespec64_trunc(attr->ia_ctime, - inode->i_sb->s_time_gran); + if (attr->ia_valid & ATTR_ATIME) { + inode->i_atime = timestamp_truncate(attr->ia_atime, + inode); + } + if (attr->ia_valid & ATTR_MTIME) { + inode->i_mtime = timestamp_truncate(attr->ia_mtime, + inode); + } + if (attr->ia_valid & ATTR_CTIME) { + inode->i_ctime = timestamp_truncate(attr->ia_ctime, + inode); + } if (attr->ia_valid & ATTR_MODE) { umode_t mode = attr->ia_mode; From patchwork Tue Jul 30 01:49:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11064815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3ED2A746 for ; Tue, 30 Jul 2019 01:51:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D25028600 for ; Tue, 30 Jul 2019 01:51:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1ECEE28716; Tue, 30 Jul 2019 01:51:53 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 C32F528600 for ; Tue, 30 Jul 2019 01:51:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730821AbfG3BuY (ORCPT ); Mon, 29 Jul 2019 21:50:24 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:42671 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730780AbfG3BuY (ORCPT ); Mon, 29 Jul 2019 21:50:24 -0400 Received: by mail-pf1-f195.google.com with SMTP id q10so28931294pff.9; Mon, 29 Jul 2019 18:50:24 -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=RW8wa5CmvNow6jsuxhZgtbxifDJuKVtv4F+8WUaIVIU=; b=YwmjPnB19KAj+BjmIJ50cdgeFM5UHFfUDO0cpXF0s+JcgHsVn1lYYhQ/4LCBEuEQ81 4BZt/eGZWaz2Yfk+Dq8a8mJWVY5q3Xfq5+S0qlPEKml8x72HTXAYahrfG2/Tocc5fT5r 85xAHR4qucnnndtFeLW244mj+SpwP590cPXHRy+WJkiO+ffBRDC6SvcdzwcE3wgV5wJ3 NbCapeZbQOcVTVmfTlZ1xeF5mXVPFYeo1f3frjsMEjiSFOb+t1IOymYCw/o/1s8n3s4A Sb0g7mrj/CnrmyOB8+sDfwEwrqG5ovtGVpkqjJjnYicE4aGDMpfeUEu3YNMqeZFv6kjM 6mLQ== 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=RW8wa5CmvNow6jsuxhZgtbxifDJuKVtv4F+8WUaIVIU=; b=HDZfO5b6sUjdMD1RLdfNpx4neJEbx2WFJ+IJ9XC6yXLeWS84VxYulOEWC7NzodBfgF K2l5SmOGjs+js0uyWwOVAcchl6/NzoFT9n0qwb11RJR9WN7Miw2xSAEXL8JrOrDaeqVI 9arVmfuME47kyDuHJ5j1D244bjjQQ5KIACtLmAIXC7YMvInKQh4YSdTzMkqCGjcRMwIF d/hvBJO17k0n4akcnk+qUQBVDM+YS/u6woG/Jn4OgalUPzu18eTK7Pl9fKFQb7N49VpR yNTY6tXwHFE//B72RgvkOzdjV27yUYbsdjamTBBwtx0BjaPqchp3clcWRvWz5AdqEjU1 8MIg== X-Gm-Message-State: APjAAAWlDwXodu6BJ+U2b4fHAZKp530oYiNoA4lxrynjUz5BLQQgfnXJ TfgdejmhH6B3+BGgimXkMBg= X-Google-Smtp-Source: APXvYqz29EMBCshdmdETjuOL+Tr9F3tUgVJAtBZcxutuiiC/3ISyMH46dd/NGOfeMhYKjxoEaaHKkA== X-Received: by 2002:a62:174a:: with SMTP id 71mr40680263pfx.140.1564451423830; Mon, 29 Jul 2019 18:50:23 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id r6sm138807156pjb.22.2019.07.29.18.50.23 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 18:50:23 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org Subject: [PATCH 04/20] mount: Add mount warning for impending timestamp expiry Date: Mon, 29 Jul 2019 18:49:08 -0700 Message-Id: <20190730014924.2193-5-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190730014924.2193-1-deepa.kernel@gmail.com> References: <20190730014924.2193-1-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 The warning reuses the uptime max of 30 years used by the setitimeofday(). Note that the warning is only added for new filesystem mounts through the mount syscall. Automounts do not have the same warning. Signed-off-by: Deepa Dinamani --- fs/namespace.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fs/namespace.c b/fs/namespace.c index b26778bdc236..5314fac8035e 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2739,6 +2739,17 @@ static int do_new_mount_fc(struct fs_context *fc, struct path *mountpoint, error = do_add_mount(real_mount(mnt), mountpoint, mnt_flags); if (error < 0) mntput(mnt); + + if (!error && sb->s_time_max && + (ktime_get_real_seconds() + TIME_UPTIME_SEC_MAX > sb->s_time_max)) { + char *buf = (char *)__get_free_page(GFP_KERNEL); + char *mntpath = buf ? d_path(mountpoint, buf, PAGE_SIZE) : ERR_PTR(-ENOMEM); + + pr_warn("Mounted %s file system at %s supports timestamps until 0x%llx\n", + fc->fs_type->name, mntpath, (unsigned long long)sb->s_time_max); + free_page((unsigned long)buf); + } + return error; } From patchwork Tue Jul 30 01:49:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11064773 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 14F3A746 for ; Tue, 30 Jul 2019 01:50:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0240228600 for ; Tue, 30 Jul 2019 01:50:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7F2528714; Tue, 30 Jul 2019 01:50:28 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 2AE7F28600 for ; Tue, 30 Jul 2019 01:50:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730834AbfG3Bu0 (ORCPT ); Mon, 29 Jul 2019 21:50:26 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:43564 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730829AbfG3BuZ (ORCPT ); Mon, 29 Jul 2019 21:50:25 -0400 Received: by mail-pf1-f193.google.com with SMTP id i189so28949573pfg.10; Mon, 29 Jul 2019 18:50:25 -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=o10DUO5dEIQstB6p+42EOsG96pidROgmozIpVkiPhZk=; b=AtD608eCTmGCbG2RQYuTeyjUti0VNtTfCfQ+vCcFRD8QDQZmw7/F8T6mE670/qTYNj 31zi69dyn7ge70xQeKw5o2EYGqK9oaYEXotVW/WEbgtBnHEZXH8kIPbiBpr89RyMNPq9 SdPoQsFtGTW2KfC03miJEC+JIE1MQLdiIwoIGflkA2v/8dcje9cA0WjIXE+VSRts3NRv jMHzFkskc3vie/+KbhBuP8CqduvHG/iugP3Xvs7lS4ktvWS4xB4seh19oxG5yr/n7DKD lToykY13dw15f6j9iL43VkEwNrUx1pVtcONfcnOJ5TKV2BE2L73KmeI2WZmauqY4eF7B +csw== 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=o10DUO5dEIQstB6p+42EOsG96pidROgmozIpVkiPhZk=; b=ZJZ/m0fFI+PvvAeLWo3j3pXhaG1UYc/nmVSEI84JA7o2Riu6Yy4iWwSIsGvp5gxV0G I05unEULeJyZUNZzzwS6G2mkyAyynY99lWPKUCpW3rLHwN528McUHftA2OQJigskZ5vN Bk8LMpl5CPxicwaLy8tM5tYe6tWtqxcTfUUFOYW5pvKHGAgRRg1tAMfJA33aD4ZdZ0L+ Fwf5vt66LYa+3Mhvmr4k6QuNsZZ4PofTABUL3+vEoNjFP0QjameKqH7yNtZ6debKGViD aHAh+/sH6xSfiE7zqj5oUN8DiEf5KORbSu+pynjVkIk7AJWW62R5F1b77YNOR5igmxFS IQJQ== X-Gm-Message-State: APjAAAXditTDlpyXkrtLQXLrH7F15QAZrYF5fFXtxP8IbMCBexBRmId5 o6KjKCKjHMBHnOlW6YeFA0o= X-Google-Smtp-Source: APXvYqwNoGUy/BYWsCRcIxS2wctsm4ggNIqk3MCZ3a8pDhKO9QuJPxZuEulwOvT7X2WWllFjpJxxVg== X-Received: by 2002:aa7:96a4:: with SMTP id g4mr40955745pfk.193.1564451424669; Mon, 29 Jul 2019 18:50:24 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id r6sm138807156pjb.22.2019.07.29.18.50.23 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 18:50:24 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org Subject: [PATCH 05/20] utimes: Clamp the timestamps before update Date: Mon, 29 Jul 2019 18:49:09 -0700 Message-Id: <20190730014924.2193-6-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190730014924.2193-1-deepa.kernel@gmail.com> References: <20190730014924.2193-1-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 POSIX is ambiguous on the behavior of timestamps for futimens, utimensat and utimes. Whether to return an error or silently clamp a timestamp beyond the range supported by the underlying filesystems is not clear. POSIX.1 section for futimens, utimensat and utimes says: (http://pubs.opengroup.org/onlinepubs/9699919799/functions/futimens.html) The file's relevant timestamp shall be set to the greatest value supported by the file system that is not greater than the specified time. If the tv_nsec field of a timespec structure has the special value UTIME_NOW, the file's relevant timestamp shall be set to the greatest value supported by the file system that is not greater than the current time. [EINVAL] A new file timestamp would be a value whose tv_sec component is not a value supported by the file system. The patch chooses to clamp the timestamps according to the filesystem timestamp ranges and does not return an error. This is in line with the behavior of utime syscall also since the POSIX page(http://pubs.opengroup.org/onlinepubs/009695399/functions/utime.html) for utime does not mention returning an error or clamping like above. Same for utimes http://pubs.opengroup.org/onlinepubs/009695399/functions/utimes.html Signed-off-by: Deepa Dinamani --- fs/utimes.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/fs/utimes.c b/fs/utimes.c index 350c9c16ace1..4c1a2ce90bbc 100644 --- a/fs/utimes.c +++ b/fs/utimes.c @@ -21,6 +21,7 @@ static int utimes_common(const struct path *path, struct timespec64 *times) int error; struct iattr newattrs; struct inode *inode = path->dentry->d_inode; + struct super_block *sb = inode->i_sb; struct inode *delegated_inode = NULL; error = mnt_want_write(path->mnt); @@ -36,16 +37,24 @@ static int utimes_common(const struct path *path, struct timespec64 *times) if (times[0].tv_nsec == UTIME_OMIT) newattrs.ia_valid &= ~ATTR_ATIME; else if (times[0].tv_nsec != UTIME_NOW) { - newattrs.ia_atime.tv_sec = times[0].tv_sec; - newattrs.ia_atime.tv_nsec = times[0].tv_nsec; + newattrs.ia_atime.tv_sec = + clamp(times[0].tv_sec, sb->s_time_min, sb->s_time_max); + if (times[0].tv_sec == sb->s_time_max || times[0].tv_sec == sb->s_time_min) + newattrs.ia_atime.tv_nsec = 0; + else + newattrs.ia_atime.tv_nsec = times[0].tv_nsec; newattrs.ia_valid |= ATTR_ATIME_SET; } if (times[1].tv_nsec == UTIME_OMIT) newattrs.ia_valid &= ~ATTR_MTIME; else if (times[1].tv_nsec != UTIME_NOW) { - newattrs.ia_mtime.tv_sec = times[1].tv_sec; - newattrs.ia_mtime.tv_nsec = times[1].tv_nsec; + newattrs.ia_mtime.tv_sec = + clamp(times[1].tv_sec, sb->s_time_min, sb->s_time_max); + if (times[1].tv_sec >= sb->s_time_max || times[1].tv_sec == sb->s_time_min) + newattrs.ia_mtime.tv_nsec = 0; + else + newattrs.ia_mtime.tv_nsec = times[1].tv_nsec; newattrs.ia_valid |= ATTR_MTIME_SET; } /* From patchwork Tue Jul 30 01:49:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11064813 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2F6F5112C for ; Tue, 30 Jul 2019 01:51:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F72D28739 for ; Tue, 30 Jul 2019 01:51:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E9E528716; Tue, 30 Jul 2019 01:51:50 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 5D4AC286DB for ; Tue, 30 Jul 2019 01:51:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731067AbfG3Bvn (ORCPT ); Mon, 29 Jul 2019 21:51:43 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:43567 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730837AbfG3Bu1 (ORCPT ); Mon, 29 Jul 2019 21:50:27 -0400 Received: by mail-pf1-f194.google.com with SMTP id i189so28949610pfg.10; Mon, 29 Jul 2019 18:50:26 -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=CJvht37EZemmcnBgtlNiz9+F+TMC9CP5JC3nxpy4VdY=; b=GYkm93F1cJJjois+RV8eMjig9xIYQGk+SUnlQDx43S+Uu/41dHNKq90eVf618tDeUr WEhiGiy+V5MiKxL76vvoq57Fv52TCb6McUeald2lUzRsAlH+djZTCx912xz1xe/0uhYF raBQiGP750m/gqcyG2+H2THhlCHvYbdV9cbIZ5XSHgORnKCeuL6V7rrfuzm7WbifsB/e G0zvOt+LVA9KtaEu6+9piTZLiIDyeuqyGnhvHXnLUfRKpsjGvo2fnsVCgoerB7LL2t1j DkiSzSFuxoUY16+Xnrx6oiR20x5Cq+JMCahtn/DNTqBOsUs+1/tmZeAf61XUNw7gdTOR tE4A== 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=CJvht37EZemmcnBgtlNiz9+F+TMC9CP5JC3nxpy4VdY=; b=c++eOynR/75hAdNEql4xAgHunXxIBT+8EGE07x4qh7Ucp1Gnq0easXXS4ZrJN7N0O8 uWtSETtaZALUQaBh9dupvKV3UPlJHrjHFU4FLfVDoKUTw1rkLuLEY3HylviYu+jR6jEm 70OJ8inwjyLZgQmDKsuCbmt2m0K/Adjj3fsijx3a84VgEdcl/+cVFB4RHjRv9bm3E+H+ sG8vC9IiXmrswO3XQFXnlBKGnF/ymtT+y567iWO21ehoEOAMZ31CefRQNZam5DGTRE7d D+/wNeSNq7TLtX1zFwoXUDc6rM8szU1zoeC/q+mXceXH/3Ex5rMou+KjwXz9e9GXCbFG ByOg== X-Gm-Message-State: APjAAAUV74SSj7Px5abA2h87lpafIpkSjbsOvzBIMa5twm2zMT9V2xWM iv7J6BMSvYxRIyOrlnUjpRU= X-Google-Smtp-Source: APXvYqw9HM2FyYpOSBZ+oV02s33RW4zpOn3lB0rMSooqL418lTjpdNtWteRxv46hIS/3Tw3gww5h6Q== X-Received: by 2002:a62:e315:: with SMTP id g21mr40609144pfh.225.1564451426354; Mon, 29 Jul 2019 18:50:26 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id r6sm138807156pjb.22.2019.07.29.18.50.24 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 18:50:25 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org, aivazian.tigran@gmail.com, al@alarsen.net, coda@cs.cmu.edu, darrick.wong@oracle.com, dushistov@mail.ru, dwmw2@infradead.org, hch@infradead.org, jack@suse.com, jaharkes@cs.cmu.edu, luisbg@kernel.org, nico@fluxnic.net, phillip@squashfs.org.uk, richard@nod.at, salah.triki@gmail.com, shaggy@kernel.org, linux-xfs@vger.kernel.org, codalist@coda.cs.cmu.edu, linux-ext4@vger.kernel.org, linux-mtd@lists.infradead.org, jfs-discussion@lists.sourceforge.net, reiserfs-devel@vger.kernel.org Subject: [PATCH 06/20] fs: Fill in max and min timestamps in superblock Date: Mon, 29 Jul 2019 18:49:10 -0700 Message-Id: <20190730014924.2193-7-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190730014924.2193-1-deepa.kernel@gmail.com> References: <20190730014924.2193-1-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 Fill in the appropriate limits to avoid inconsistencies in the vfs cached inode times when timestamps are outside the permitted range. Even though some filesystems are read-only, fill in the timestamps to reflect the on-disk representation. Signed-off-by: Deepa Dinamani Cc: aivazian.tigran@gmail.com Cc: al@alarsen.net Cc: coda@cs.cmu.edu Cc: darrick.wong@oracle.com Cc: dushistov@mail.ru Cc: dwmw2@infradead.org Cc: hch@infradead.org Cc: jack@suse.com Cc: jaharkes@cs.cmu.edu Cc: luisbg@kernel.org Cc: nico@fluxnic.net Cc: phillip@squashfs.org.uk Cc: richard@nod.at Cc: salah.triki@gmail.com Cc: shaggy@kernel.org Cc: linux-xfs@vger.kernel.org Cc: codalist@coda.cs.cmu.edu Cc: linux-ext4@vger.kernel.org Cc: linux-mtd@lists.infradead.org Cc: jfs-discussion@lists.sourceforge.net Cc: reiserfs-devel@vger.kernel.org Reviewed-by: Darrick J. Wong --- fs/befs/linuxvfs.c | 2 ++ fs/bfs/inode.c | 2 ++ fs/coda/inode.c | 3 +++ fs/cramfs/inode.c | 2 ++ fs/efs/super.c | 2 ++ fs/ext2/super.c | 2 ++ fs/freevxfs/vxfs_super.c | 2 ++ fs/jffs2/fs.c | 3 +++ fs/jfs/super.c | 2 ++ fs/minix/inode.c | 2 ++ fs/qnx4/inode.c | 2 ++ fs/qnx6/inode.c | 2 ++ fs/reiserfs/super.c | 3 +++ fs/romfs/super.c | 2 ++ fs/squashfs/super.c | 2 ++ fs/ufs/super.c | 7 +++++++ fs/xfs/xfs_super.c | 2 ++ 17 files changed, 42 insertions(+) diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 462d096ff3e9..64cdf4d8e424 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -893,6 +893,8 @@ befs_fill_super(struct super_block *sb, void *data, int silent) sb_set_blocksize(sb, (ulong) befs_sb->block_size); sb->s_op = &befs_sops; sb->s_export_op = &befs_export_operations; + sb->s_time_min = 0; + sb->s_time_max = 0xffffffffffffll; root = befs_iget(sb, iaddr2blockno(sb, &(befs_sb->root_dir))); if (IS_ERR(root)) { ret = PTR_ERR(root); diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c index 5e97bed073d7..f8ce1368218b 100644 --- a/fs/bfs/inode.c +++ b/fs/bfs/inode.c @@ -324,6 +324,8 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) return -ENOMEM; mutex_init(&info->bfs_lock); s->s_fs_info = info; + s->s_time_min = 0; + s->s_time_max = U32_MAX; sb_set_blocksize(s, BFS_BSIZE); diff --git a/fs/coda/inode.c b/fs/coda/inode.c index 321f56e487cb..b1c70e2b9b1e 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c @@ -188,6 +188,9 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) sb->s_magic = CODA_SUPER_MAGIC; sb->s_op = &coda_super_operations; sb->s_d_op = &coda_dentry_operations; + sb->s_time_gran = 1; + sb->s_time_min = S64_MIN; + sb->s_time_max = S64_MAX; error = super_setup_bdi(sb); if (error) diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c index 9352487bd0fc..4d1d8b7761ed 100644 --- a/fs/cramfs/inode.c +++ b/fs/cramfs/inode.c @@ -597,6 +597,8 @@ static int cramfs_finalize_super(struct super_block *sb, /* Set it all up.. */ sb->s_flags |= SB_RDONLY; + sb->s_time_min = 0; + sb->s_time_max = 0; sb->s_op = &cramfs_ops; root = get_cramfs_inode(sb, cramfs_root, 0); if (IS_ERR(root)) diff --git a/fs/efs/super.c b/fs/efs/super.c index 867fc24dee20..4a6ebff2af76 100644 --- a/fs/efs/super.c +++ b/fs/efs/super.c @@ -257,6 +257,8 @@ static int efs_fill_super(struct super_block *s, void *d, int silent) if (!sb) return -ENOMEM; s->s_fs_info = sb; + s->s_time_min = 0; + s->s_time_max = U32_MAX; s->s_magic = EFS_SUPER_MAGIC; if (!sb_set_blocksize(s, EFS_BLOCKSIZE)) { diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 44eb6e7eb492..baa36c6fb71e 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -1002,6 +1002,8 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) sb->s_maxbytes = ext2_max_size(sb->s_blocksize_bits); sb->s_max_links = EXT2_LINK_MAX; + sb->s_time_min = S32_MIN; + sb->s_time_max = S32_MAX; if (le32_to_cpu(es->s_rev_level) == EXT2_GOOD_OLD_REV) { sbi->s_inode_size = EXT2_GOOD_OLD_INODE_SIZE; diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c index a89f68c3cbed..578a5062706e 100644 --- a/fs/freevxfs/vxfs_super.c +++ b/fs/freevxfs/vxfs_super.c @@ -229,6 +229,8 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) sbp->s_op = &vxfs_super_ops; sbp->s_fs_info = infp; + sbp->s_time_min = 0; + sbp->s_time_max = U32_MAX; if (!vxfs_try_sb_magic(sbp, silent, 1, (__force __fs32)cpu_to_le32(VXFS_SUPER_MAGIC))) { diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index 8a20ddd25f2d..d0b59d03a7a9 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c @@ -590,6 +590,9 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent) sb->s_blocksize = PAGE_SIZE; sb->s_blocksize_bits = PAGE_SHIFT; sb->s_magic = JFFS2_SUPER_MAGIC; + sb->s_time_min = 0; + sb->s_time_max = U32_MAX; + if (!sb_rdonly(sb)) jffs2_start_garbage_collect_thread(c); return 0; diff --git a/fs/jfs/super.c b/fs/jfs/super.c index f4e10cb9f734..b2dc4d1f9dcc 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c @@ -503,6 +503,8 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) sb->s_fs_info = sbi; sb->s_max_links = JFS_LINK_MAX; + sb->s_time_min = 0; + sb->s_time_max = U32_MAX; sbi->sb = sb; sbi->uid = INVALID_UID; sbi->gid = INVALID_GID; diff --git a/fs/minix/inode.c b/fs/minix/inode.c index f96073f25432..7cb5fd38eb14 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c @@ -277,6 +277,8 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) /* set up enough so that it can read an inode */ s->s_op = &minix_sops; + s->s_time_min = 0; + s->s_time_max = U32_MAX; root_inode = minix_iget(s, MINIX_ROOT_INO); if (IS_ERR(root_inode)) { ret = PTR_ERR(root_inode); diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c index 922d083bbc7c..e8da1cde87b9 100644 --- a/fs/qnx4/inode.c +++ b/fs/qnx4/inode.c @@ -201,6 +201,8 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent) s->s_op = &qnx4_sops; s->s_magic = QNX4_SUPER_MAGIC; s->s_flags |= SB_RDONLY; /* Yup, read-only yet */ + s->s_time_min = 0; + s->s_time_max = U32_MAX; /* Check the superblock signature. Since the qnx4 code is dangerous, we should leave as quickly as possible diff --git a/fs/qnx6/inode.c b/fs/qnx6/inode.c index 0f8b0ff1ba43..345db56c98fd 100644 --- a/fs/qnx6/inode.c +++ b/fs/qnx6/inode.c @@ -429,6 +429,8 @@ static int qnx6_fill_super(struct super_block *s, void *data, int silent) s->s_op = &qnx6_sops; s->s_magic = QNX6_SUPER_MAGIC; s->s_flags |= SB_RDONLY; /* Yup, read-only yet */ + s->s_time_min = 0; + s->s_time_max = U32_MAX; /* ease the later tree level calculations */ sbi = QNX6_SB(s); diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index ab028ea0e561..d69b4ac0ae2f 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c @@ -1976,6 +1976,9 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) goto error_unlocked; } + s->s_time_min = 0; + s->s_time_max = U32_MAX; + rs = SB_DISK_SUPER_BLOCK(s); /* * Let's do basic sanity check to verify that underlying device is not diff --git a/fs/romfs/super.c b/fs/romfs/super.c index 7d580f7c3f1d..a42c0e3079dc 100644 --- a/fs/romfs/super.c +++ b/fs/romfs/super.c @@ -478,6 +478,8 @@ static int romfs_fill_super(struct super_block *sb, void *data, int silent) sb->s_maxbytes = 0xFFFFFFFF; sb->s_magic = ROMFS_MAGIC; sb->s_flags |= SB_RDONLY | SB_NOATIME; + sb->s_time_min = 0; + sb->s_time_max = 0; sb->s_op = &romfs_super_ops; #ifdef CONFIG_ROMFS_ON_MTD diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c index effa638d6d85..a9e9837617a9 100644 --- a/fs/squashfs/super.c +++ b/fs/squashfs/super.c @@ -183,6 +183,8 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent) (u64) le64_to_cpu(sblk->id_table_start)); sb->s_maxbytes = MAX_LFS_FILESIZE; + sb->s_time_min = 0; + sb->s_time_max = U32_MAX; sb->s_flags |= SB_RDONLY; sb->s_op = &squashfs_super_ops; diff --git a/fs/ufs/super.c b/fs/ufs/super.c index 4ed0dca52ec8..1da0be667409 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c @@ -843,6 +843,10 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) sb->s_maxbytes = MAX_LFS_FILESIZE; + sb->s_time_gran = NSEC_PER_SEC; + sb->s_time_min = S32_MIN; + sb->s_time_max = S32_MAX; + switch (sbi->s_mount_opt & UFS_MOUNT_UFSTYPE) { case UFS_MOUNT_UFSTYPE_44BSD: UFSD("ufstype=44bsd\n"); @@ -861,6 +865,9 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) uspi->s_fshift = 9; uspi->s_sbsize = super_block_size = 1536; uspi->s_sbbase = 0; + sb->s_time_gran = 1; + sb->s_time_min = S64_MIN; + sb->s_time_max = S64_MAX; flags |= UFS_TYPE_UFS2 | UFS_DE_44BSD | UFS_UID_44BSD | UFS_ST_44BSD | UFS_CG_44BSD; break; diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index a14d11d78bd8..1a0daf46bae8 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1685,6 +1685,8 @@ xfs_fs_fill_super( sb->s_maxbytes = xfs_max_file_offset(sb->s_blocksize_bits); sb->s_max_links = XFS_MAXLINK; sb->s_time_gran = 1; + sb->s_time_min = S32_MIN; + sb->s_time_max = S32_MAX; set_posix_acl_flag(sb); /* version 5 superblocks support inode version counters. */ From patchwork Tue Jul 30 01:49:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11064809 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E7654746 for ; Tue, 30 Jul 2019 01:51:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9AB328600 for ; Tue, 30 Jul 2019 01:51:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD60728718; Tue, 30 Jul 2019 01:51:42 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 77C3828600 for ; Tue, 30 Jul 2019 01:51:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730850AbfG3Bu2 (ORCPT ); Mon, 29 Jul 2019 21:50:28 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:34278 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730844AbfG3Bu2 (ORCPT ); Mon, 29 Jul 2019 21:50:28 -0400 Received: by mail-pg1-f194.google.com with SMTP id n9so22944751pgc.1; Mon, 29 Jul 2019 18:50:27 -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=i+LRMSNrj6ysytmm99Rc/BfD1o0cWeoJWbC6wV2pjKo=; b=AOaRnw02TsiwbCxYhAlzGLg8nzDQpMpWKxAHBFB2a2RvzGYWBZFg5mRgPqCx4Vu/Ln F7AFryz6gakJOc7pt1+Mezu2nTV+CoYiOL0kEEDEplGq85bmjpgLLccmlg+RkfTCu6vA j2pCVHiq3XiXaquRa8YxS9yV/LSwebuWDnGqey3jTN7oa1PMiu5QXpqxjPR5zvMOg8hH LAev1+8dhbQDkV1bVk7/YLZuJXDimbINKT82EOpErLSxfD/z9gYMmjcue8T+bzhmVtTr DC5m/iDWQFAem/S70vYShqEKwYB81IyQocXsx9QoCdZfX8oI2+osvKNsj2t6+8Uh+4ky im8w== 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=i+LRMSNrj6ysytmm99Rc/BfD1o0cWeoJWbC6wV2pjKo=; b=Ly8bwe+btewquGWf+6h6tkbJvPIp1+OnrrDpRS21jjiibwOS8/DJMs2MITkt2CLJsq SOuh6Nb7N+WGYg7wTUhQ4/a2niv7KNY3ZfcUXhizWAyo3IrutQ6/n8vs5VCRkSpGh8AU HG8XLAjo7qDSLrigGq7u3KnVa1BKYgLWJPB0JynFVS3kGSHS/X43iO1A1Ivv8/eT0c5b BYtfgvLOGhXe61wsy0IC11qOAgm7EktchMJ/bJCNd0lkhaq3GFuq9c0gVak/jzpAZP+p G7kyicLuPIGgIClOAgFpEw/2PhlTHdithobliDo3I0t1LJaN7nmk3skJs16NouBvkZM8 EFzw== X-Gm-Message-State: APjAAAWvDNFt6U2iZRpPKcWe/uOC13J2Zm2xS34OMKXfEe53hz2lSdHi KyrvMd8vdAsdsWLkJFTL7cQ= X-Google-Smtp-Source: APXvYqzh6lY3nSUp4F9grKKAti8Q66DXm71R/Zu8sXqaO+Na/2RIljxHn26XwhCIyD2K77n58g3ICg== X-Received: by 2002:a63:b747:: with SMTP id w7mr53077423pgt.205.1564451427431; Mon, 29 Jul 2019 18:50:27 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id r6sm138807156pjb.22.2019.07.29.18.50.26 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 18:50:27 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org, ericvh@gmail.com, lucho@ionkov.net, asmadeus@codewreck.org, v9fs-developer@lists.sourceforge.net Subject: [PATCH 07/20] 9p: Fill min and max timestamps in sb Date: Mon, 29 Jul 2019 18:49:11 -0700 Message-Id: <20190730014924.2193-8-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190730014924.2193-1-deepa.kernel@gmail.com> References: <20190730014924.2193-1-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 struct p9_wstat and struct p9_stat_dotl indicate that the wire transport uses u32 and u64 fields for timestamps. Fill in the appropriate limits to avoid inconsistencies in the vfs cached inode times when timestamps are outside the permitted range. Note that the upper bound for V9FS_PROTO_2000L is retained as S64_MAX. This is because that is the upper bound supported by vfs. Signed-off-by: Deepa Dinamani Cc: ericvh@gmail.com Cc: lucho@ionkov.net Cc: asmadeus@codewreck.org Cc: v9fs-developer@lists.sourceforge.net --- fs/9p/vfs_super.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 08112fbcaece..ca243e658d71 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c @@ -69,8 +69,12 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses, if (v9fs_proto_dotl(v9ses)) { sb->s_op = &v9fs_super_ops_dotl; sb->s_xattr = v9fs_xattr_handlers; - } else + } else { sb->s_op = &v9fs_super_ops; + sb->s_time_max = U32_MAX; + } + + sb->s_time_min = 0; ret = super_setup_bdi(sb); if (ret) From patchwork Tue Jul 30 01:49:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11064775 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B6188112C for ; Tue, 30 Jul 2019 01:50:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6FC628600 for ; Tue, 30 Jul 2019 01:50:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B94428714; Tue, 30 Jul 2019 01:50:31 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 3D25028600 for ; Tue, 30 Jul 2019 01:50:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730860AbfG3Bu3 (ORCPT ); Mon, 29 Jul 2019 21:50:29 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:44260 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730854AbfG3Bu3 (ORCPT ); Mon, 29 Jul 2019 21:50:29 -0400 Received: by mail-pf1-f196.google.com with SMTP id t16so28915662pfe.11; Mon, 29 Jul 2019 18:50:29 -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=IiHYsAumGmwMilrFK0b/NUIB9co6Y5UEsmqHb9nGQyU=; b=ISJ9TA4FZmcd7womrY0uIyLdNdlSuPdhvjTVi55bbvOo+4KcTQunZschTJxOgpfE0i xJQa3/ZoUAGWP+kk/km2Ros4yCR2rqZVzoR9laFigM+l08Ywd1UHScAvQwhT5fh8Q1BL 1WcDAjqMV+yBT1Sxb4i52Eq22z2+ROZ13HPf+0GKKFwuFZas8FtECFuI1uoXl5aM/c27 VfV4pjxDaPvusEDoNfuaKvSlqG5omKPtpxWhEOiM/zDwxaflk9RhCT2EU52hNXO78iWB g4e1rgQ6HhYY21QsJGUoDj6uXt+drYVcY1dqSgwf5/ytHAl5GtZu4AWz3tgJ53Cw3zMx 7gwg== 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=IiHYsAumGmwMilrFK0b/NUIB9co6Y5UEsmqHb9nGQyU=; b=soNTj2bvI6nRTKMQgrAkbaPGYNudNEv8gYB0vmeGdBYBofND4E+ySY+2UN2D0nokz7 IsxlJLhlDLNnDboiSgLzYmPSaOley6S/oyw7gQHDtkhRUQhwtNH8ogseneuuB0nrKs/9 1lfdDSiPJG3hN73cv2aWVOoMMrEB+0c6LWZiOxjcmsspdbazaQeUmQMh651/4A8li0iw n1jHxyxsqI5C0QgQnPTYy46KURuGtDNZ1GRPxG/cisQckZ9+BKfr3Qrx2k6os51+BR91 fiSerRKCJZyfUk7vmyk0AAuF13YU6P9EPGzYGJfclHjh6xBQXCqrSVtsCMzxWJr8cOME iSSA== X-Gm-Message-State: APjAAAWdVtu0jFIPRgefutV943oY5X7+5nHmb4N5/w+P6ahBXxhMf+89 pnQRqFe86TOWlPztyCKmXkg= X-Google-Smtp-Source: APXvYqy7CBHQMm439yEyjRbQweRYrXZDCuISH7LHBxFLktyDgLRupH2Pa3t6gj+0pivswKb1FS+xXg== X-Received: by 2002:a65:5a44:: with SMTP id z4mr107194289pgs.41.1564451428828; Mon, 29 Jul 2019 18:50:28 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id r6sm138807156pjb.22.2019.07.29.18.50.27 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 18:50:28 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org Subject: [PATCH 08/20] adfs: Fill in max and min timestamps in sb Date: Mon, 29 Jul 2019 18:49:12 -0700 Message-Id: <20190730014924.2193-9-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190730014924.2193-1-deepa.kernel@gmail.com> References: <20190730014924.2193-1-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 Fill in the appropriate limits to avoid inconsistencies in the vfs cached inode times when timestamps are outside the permitted range. Note that the min timestamp is assumed to be 01 Jan 1970 00:00:00 (Unix epoch). This is consistent with the way we convert timestamps in adfs_adfs2unix_time(). Signed-off-by: Deepa Dinamani --- fs/adfs/adfs.h | 13 +++++++++++++ fs/adfs/inode.c | 8 ++------ fs/adfs/super.c | 2 ++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/fs/adfs/adfs.h b/fs/adfs/adfs.h index 804c6a77c5db..781b1c3817e0 100644 --- a/fs/adfs/adfs.h +++ b/fs/adfs/adfs.h @@ -2,6 +2,19 @@ #include #include +/* + * 01 Jan 1970 00:00:00 (Unix epoch) as seconds since + * 01 Jan 1900 00:00:00 (RISC OS epoch) + */ +#define RISC_OS_EPOCH_DELTA 2208988800LL + +/* + * Convert 40 bit centi seconds to seconds + * since 01 Jan 1900 00:00:00 (RISC OS epoch) + * The result is 2248-06-03 06:57:57 GMT + */ +#define ADFS_MAX_TIMESTAMP ((0xFFFFFFFFFFLL / 100) - RISC_OS_EPOCH_DELTA) + /* Internal data structures for ADFS */ #define ADFS_FREE_FRAG 0 diff --git a/fs/adfs/inode.c b/fs/adfs/inode.c index 66621e96f9af..3f75cefc0380 100644 --- a/fs/adfs/inode.c +++ b/fs/adfs/inode.c @@ -170,11 +170,7 @@ static void adfs_adfs2unix_time(struct timespec64 *tv, struct inode *inode) { unsigned int high, low; - /* 01 Jan 1970 00:00:00 (Unix epoch) as nanoseconds since - * 01 Jan 1900 00:00:00 (RISC OS epoch) - */ - static const s64 nsec_unix_epoch_diff_risc_os_epoch = - 2208988800000000000LL; + static const s64 nsec_unix_epoch_diff_risc_os_epoch = RISC_OS_EPOCH_DELTA * NSEC_PER_SEC; s64 nsec; if (ADFS_I(inode)->stamped == 0) @@ -219,7 +215,7 @@ adfs_unix2adfs_time(struct inode *inode, unsigned int secs) if (ADFS_I(inode)->stamped) { /* convert 32-bit seconds to 40-bit centi-seconds */ low = (secs & 255) * 100; - high = (secs / 256) * 100 + (low >> 8) + 0x336e996a; + high = (secs / 256) * 100 + (low >> 8) + (RISC_OS_EPOCH_DELTA*100/256); ADFS_I(inode)->loadaddr = (high >> 24) | (ADFS_I(inode)->loadaddr & ~0xff); diff --git a/fs/adfs/super.c b/fs/adfs/super.c index 2a83655c408f..0a0854ef9e3c 100644 --- a/fs/adfs/super.c +++ b/fs/adfs/super.c @@ -449,6 +449,8 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent) asb->s_size = adfs_discsize(dr, sb->s_blocksize_bits); asb->s_version = dr->format_version; asb->s_log2sharesize = dr->log2sharesize; + sb->s_time_min = 0; + sb->s_time_max = ADFS_MAX_TIMESTAMP; asb->s_map = adfs_read_map(sb, dr); if (IS_ERR(asb->s_map)) { From patchwork Tue Jul 30 01:49:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11064807 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 62305746 for ; Tue, 30 Jul 2019 01:51:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 51C7428600 for ; Tue, 30 Jul 2019 01:51:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 45E9028716; Tue, 30 Jul 2019 01:51:40 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 D5E7D28600 for ; Tue, 30 Jul 2019 01:51:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730870AbfG3Bub (ORCPT ); Mon, 29 Jul 2019 21:50:31 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:46338 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730861AbfG3Bua (ORCPT ); Mon, 29 Jul 2019 21:50:30 -0400 Received: by mail-pf1-f196.google.com with SMTP id c3so5806993pfa.13; Mon, 29 Jul 2019 18:50: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=rtfYQ+Fr6rn8tMWD9jomVyK2aw/48rQfrLzbB373D0w=; b=VzijVnAMb26+mnUZVJWAQvsMW5OwVnBsB2HGhcI+BaJFihiv7fy/RAZEjj88lmWd2i 2cwtl7p8aJB/hgOaT3EBy0IHyWOMiAPVLBa1jmAp4z+hsyRy0gXr59wz4YbB0fFQ5hfE Itj/SXB7EjUSvoB0mxK1aiStQEenb/tK1RwHh/V7sBB8X1H2Xthiaqzfpzd6CxqSJ2c+ 4G+aiSEKSOMWwj4t6dr6HMxajpvcIf7Pb/DIO0t9MbJNfmAQ9t5/boG4vGDkogUTPanp ddOycjrYvsR+vnGXjq9Q1q/OIQ4iNAa0xUqmBUjyoAsyg7Grj4Ao9TnymNj5mcSSTaJD 6a3g== 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=rtfYQ+Fr6rn8tMWD9jomVyK2aw/48rQfrLzbB373D0w=; b=pf+UJwJ8sqCzSMituVewd1Jbebrn72vkKXlZs8YhpfrkIPsrgU20ybsbiH5KX6eChc hhgqlnXlSEoifAKTgPIqnWqdWW/qtKQ85HO9avHoeRy9MBs/y/mi30pLIycVmOHUQnUy GM94zPMWMAU0z6cxW02iWBPxy6ApUGdpB3Nj2Q/X/G0zVyE/mg9jdQ/mmpJGHM4brwlI DAOp6OHPRxiaIdWpkwjHDduKqxdtlR9E1NUI9NO00oYZ2zRAgXVeoRQOBj47bQgRPeOq ez2qGOZ2hLySN80S+wCeQ4PqIuq2UFDlodD94R4HJIw3EE/MvXMfhpjWhx9Tmh0Iy+EX iy9g== X-Gm-Message-State: APjAAAUyBaKNnwoVkfXQePD7H+8vFyHXWz8arEUosjaX+uuiaOtqTDFY 0AIlQiYjD69mY93fmCqNOB0= X-Google-Smtp-Source: APXvYqwfwoV+k3jPwNM9uVpzpHuXPBoPSprQG+/gn8yAYSq3waSIrl+s19WGxiWLBVTtshsVUBmtxA== X-Received: by 2002:a65:41c6:: with SMTP id b6mr49714185pgq.269.1564451429776; Mon, 29 Jul 2019 18:50:29 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id r6sm138807156pjb.22.2019.07.29.18.50.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 18:50:29 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org, tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org Subject: [PATCH 09/20] ext4: Initialize timestamps limits Date: Mon, 29 Jul 2019 18:49:13 -0700 Message-Id: <20190730014924.2193-10-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190730014924.2193-1-deepa.kernel@gmail.com> References: <20190730014924.2193-1-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. The timestamp limits are calculated according to the encoding table in a4dad1ae24f85i(ext4: Fix handling of extended tv_sec): * extra msb of adjust for signed * epoch 32-bit 32-bit tv_sec to * bits time decoded 64-bit tv_sec 64-bit tv_sec valid time range * 0 0 1 -0x80000000..-0x00000001 0x000000000 1901-12-13..1969-12-31 * 0 0 0 0x000000000..0x07fffffff 0x000000000 1970-01-01..2038-01-19 * 0 1 1 0x080000000..0x0ffffffff 0x100000000 2038-01-19..2106-02-07 * 0 1 0 0x100000000..0x17fffffff 0x100000000 2106-02-07..2174-02-25 * 1 0 1 0x180000000..0x1ffffffff 0x200000000 2174-02-25..2242-03-16 * 1 0 0 0x200000000..0x27fffffff 0x200000000 2242-03-16..2310-04-04 * 1 1 1 0x280000000..0x2ffffffff 0x300000000 2310-04-04..2378-04-22 * 1 1 0 0x300000000..0x37fffffff 0x300000000 2378-04-22..2446-05-10 Note that the time limits are not correct for deletion times. Signed-off-by: Deepa Dinamani Reviewed-by: Andreas Dilger Cc: tytso@mit.edu Cc: adilger.kernel@dilger.ca Cc: linux-ext4@vger.kernel.org --- fs/ext4/ext4.h | 4 ++++ fs/ext4/super.c | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 1cb67859e051..3f13cf12ae7f 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -1631,6 +1631,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 S32_MAX +#define EXT4_TIMESTAMP_MIN S32_MIN + /* * Feature set definitions */ diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 4079605d437a..3ea2d60f33aa 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4035,8 +4035,21 @@ 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) - sb->s_time_gran = 1 << (EXT4_EPOCH_BITS - 2); + /* + * i_atime_extra is the last extra field available for [acm]times in + * struct ext4_inode. Checking for that field should suffice to ensure + * we have extra space for all three. + */ + if (sbi->s_inode_size >= offsetof(struct ext4_inode, i_atime_extra) + + sizeof(((struct ext4_inode *)0)->i_atime_extra)) { + sb->s_time_gran = 1; + sb->s_time_max = EXT4_EXTRA_TIMESTAMP_MAX; + } else { + sb->s_time_gran = NSEC_PER_SEC; + 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); From patchwork Tue Jul 30 01:49:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11064779 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3B3CD746 for ; Tue, 30 Jul 2019 01:50:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DA8828600 for ; Tue, 30 Jul 2019 01:50:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2198228739; Tue, 30 Jul 2019 01:50:35 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 BE7A1286DB for ; Tue, 30 Jul 2019 01:50:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730882AbfG3Bud (ORCPT ); Mon, 29 Jul 2019 21:50:33 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:34282 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730844AbfG3Bub (ORCPT ); Mon, 29 Jul 2019 21:50:31 -0400 Received: by mail-pg1-f195.google.com with SMTP id n9so22944806pgc.1; Mon, 29 Jul 2019 18:50:31 -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=ZeqJE/MeTBzAZVLgzu+nTLWbc1OyHy2shL2/lZCsj/E=; b=djXDCvKRCKQsZILkMke8YNvphRWUO1wNt9BAw2+CBnHgcyKzB2yFR6k6Jv35GAcuzL RxYURBvb2zV0WlSfCjgyLKb1rJDT5okkB3kgMyfyDpxTotIqoHoxkKK2HxyPHVJ6lo5B lylJZT43F5e5Gb70J/ZTV3A27aX/xtR+Oa4dDnOKoh2jLXHYvbaO0QwIQsLSqu5f+4K6 Koy36WBtfApZ3uNXCUqeBmOuUOsAxfQiVFZyF7o/VBsdaTKcvBChhHnEcPtjfPwnMJzg e0UHTVnp3ezEdMsSQRC5pMzcE1VEHXvOg0QTXo3MfwD7jjo94qhmeV0cUYCyWS6bHcLD Chwg== 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=ZeqJE/MeTBzAZVLgzu+nTLWbc1OyHy2shL2/lZCsj/E=; b=BIxWUgmYsw/t8wn04v0LJlzm1PEGYKrxFlQlMyXe7mQqzAoGEbE0XCUP5xwvyHtuic GCGrRbpFRd5ilsAen6pcHHX1RC0OlU8drzn8LN/ykkmbvNLjfhmZkHgd2WyLwKqtNaAh +jx+BXKENlKRF9aUnP/Zv5gQd4ZuQJTJeEeLLjU57hXwlVgopepGNRJ+lLnn9XKDGfyR GqVAHX40UP38Ll9lg9nioXLxjx+qpdMSCh5CqryX6mK2SnM/fhLUIas+CRCSxht5umqx CAerzQmo/N+Ptwt4uHVTzZUL+i+1BjcJBbzSgRDuA3rjwg/lvxFVvewgJz58W6qC6dzJ 8Haw== X-Gm-Message-State: APjAAAUUICZojTQo9EpYEfJ15MlkBOrHVOWXmLdkvlJeB1Aq0D6vtNun COj//ATKIu3AIc01bpq0FEU= X-Google-Smtp-Source: APXvYqwVHu5Iqz3b+zxf1ms9RX+F7inyknOw3X8ckD8V2vhhe1paXQwvZmmShsmA+JtzpJbt3hgH+w== X-Received: by 2002:a62:750c:: with SMTP id q12mr40608921pfc.59.1564451431014; Mon, 29 Jul 2019 18:50:31 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id r6sm138807156pjb.22.2019.07.29.18.50.29 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 18:50:30 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org, trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, linux-nfs@vger.kernel.org Subject: [PATCH 10/20] fs: nfs: Initialize filesystem timestamp ranges Date: Mon, 29 Jul 2019 18:49:14 -0700 Message-Id: <20190730014924.2193-11-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190730014924.2193-1-deepa.kernel@gmail.com> References: <20190730014924.2193-1-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 Fill in the appropriate limits to avoid inconsistencies in the vfs cached inode times when timestamps are outside the permitted range. The time formats for various verious is detailed in the RFCs as below: https://tools.ietf.org/html/rfc7862(time metadata) https://tools.ietf.org/html/rfc7530: nfstime4 struct nfstime4 { int64_t seconds; uint32_t nseconds; }; https://tools.ietf.org/html/rfc1094 struct timeval { unsigned int seconds; unsigned int useconds; }; https://tools.ietf.org/html/rfc1813 struct nfstime3 { uint32 seconds; uint32 nseconds; }; Use the limits as per the RFC. Signed-off-by: Deepa Dinamani Cc: trond.myklebust@hammerspace.com Cc: anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org --- fs/nfs/super.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/fs/nfs/super.c b/fs/nfs/super.c index f88ddac2dcdf..54eb5a47f180 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -2360,6 +2360,15 @@ void nfs_fill_super(struct super_block *sb, struct nfs_mount_info *mount_info) sb->s_flags |= SB_POSIXACL; sb->s_time_gran = 1; sb->s_export_op = &nfs_export_ops; + } else + sb->s_time_gran = 1000; + + if (server->nfs_client->rpc_ops->version != 4) { + sb->s_time_min = 0; + sb->s_time_max = U32_MAX; + } else { + sb->s_time_min = S64_MIN; + sb->s_time_max = S64_MAX; } nfs_initialise_sb(sb); @@ -2380,7 +2389,6 @@ static void nfs_clone_super(struct super_block *sb, sb->s_maxbytes = old_sb->s_maxbytes; sb->s_xattr = old_sb->s_xattr; sb->s_op = old_sb->s_op; - sb->s_time_gran = 1; sb->s_export_op = old_sb->s_export_op; if (server->nfs_client->rpc_ops->version != 2) { @@ -2388,6 +2396,16 @@ static void nfs_clone_super(struct super_block *sb, * so ourselves when necessary. */ sb->s_flags |= SB_POSIXACL; + sb->s_time_gran = 1; + } else + sb->s_time_gran = 1000; + + if (server->nfs_client->rpc_ops->version != 4) { + sb->s_time_min = 0; + sb->s_time_max = U32_MAX; + } else { + sb->s_time_min = S64_MIN; + sb->s_time_max = S64_MAX; } nfs_initialise_sb(sb); From patchwork Tue Jul 30 01:49:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11064805 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0C83814E5 for ; Tue, 30 Jul 2019 01:51:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2AE3286DB for ; Tue, 30 Jul 2019 01:51:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6FF228739; Tue, 30 Jul 2019 01:51: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 7BC94286DB for ; Tue, 30 Jul 2019 01:51:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731053AbfG3Bvd (ORCPT ); Mon, 29 Jul 2019 21:51:33 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:40766 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730876AbfG3Bud (ORCPT ); Mon, 29 Jul 2019 21:50:33 -0400 Received: by mail-pf1-f195.google.com with SMTP id p184so28938959pfp.7; Mon, 29 Jul 2019 18:50:32 -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=WtwY5yricjUUFTVKUgDZ3nK7nqec7Ph6cbHYobxR4wQ=; b=O+z9w0naZ1YWNbDGDlg1VRQ6JPexZ8LTW3EeZvsX12cMfb9dSMi5/ZvikfdTNDFUrk Lhv/9aDYSLhRX/QsQRuLHVKEtQtWCNRrgHuwoiJeFzr0tmym9NqZn+nrq+9liKBSgxD/ viIcUMbTAYZfGPSatlDzSSleH+zpWsrMyD9npMEcZM+JnGS8q+/LspDOgULZdn1d2TPf 97hlQz/IxufgVX/r+T6BgIepRwL2N4M8UYGpSIv60FUlRYJYGT3w1x3cmGYrekDUQpfx Fa7sUZy3nb23nysxxG3BbWMHTvPd/orMAkW3WxJnWqaZBodP7H7+e89dl4lSUsZu+CQW Sq5Q== 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=WtwY5yricjUUFTVKUgDZ3nK7nqec7Ph6cbHYobxR4wQ=; b=D+1thWMUk3Tg686+qmnlomqkPD9wlHd3Ihx8V7h2Zm5FASzC4ScZ71GxwOEP4xBqB/ g1n6I8KHKU55dsuesZs3YbXPgoNOeqv/GrEIiwaTcCgnjRvltnWQ2NWAubcu4wZsYFxR FbPhABp+l+DefUNgY88Q89sL+y3PPL9U8DdHi+qslG2AADIrrxtzgO3MvE23XAsttIn5 0EY0HFlKaLeMROcDtKa3j4XXvKZe9FVvpeXCFyDrWzKjwQzKuyU2kJpla0iVDqF3bJ7k 4/ikS9ANwVstKqr+9+ECQ5j03wMCmbqp1bXoIaXphs+RwxgoPr4iK42vp4sQizValVvG rZWw== X-Gm-Message-State: APjAAAUH1Olf2g1jsLPD0KIHarUcGgJUUGigglH79SLl+7nUJjSGM8xT yHq47wyJWjmpcqNJaLcsOGY= X-Google-Smtp-Source: APXvYqzxr2P3AtG+QgBq4Lx2+D3QSoPEWcus9Yjxal69gp9m+wMIuOUPCR9aRnyvXjKQZLijNdQ3ww== X-Received: by 2002:a65:6547:: with SMTP id a7mr85739982pgw.65.1564451432094; Mon, 29 Jul 2019 18:50:32 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id r6sm138807156pjb.22.2019.07.29.18.50.31 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 18:50:31 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org, sfrench@samba.org, linux-cifs@vger.kernel.org Subject: [PATCH 11/20] fs: cifs: Initialize filesystem timestamp ranges Date: Mon, 29 Jul 2019 18:49:15 -0700 Message-Id: <20190730014924.2193-12-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190730014924.2193-1-deepa.kernel@gmail.com> References: <20190730014924.2193-1-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 Fill in the appropriate limits to avoid inconsistencies in the vfs cached inode times when timestamps are outside the permitted range. Also fixed cnvrtDosUnixTm calculations to avoid int overflow while computing maximum date. References: http://cifs.com/ https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-cifs/d416ff7c-c536-406e-a951-4f04b2fd1d2b Signed-off-by: Deepa Dinamani Cc: sfrench@samba.org Cc: linux-cifs@vger.kernel.org --- fs/cifs/cifsfs.c | 22 ++++++++++++++++++++++ fs/cifs/netmisc.c | 14 +++++++------- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 81a16b4e1b48..94a52a63b9ea 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -56,6 +56,15 @@ #include "dfs_cache.h" #endif +/* + * DOS dates from 1980/1/1 through 2107/12/31 + * Protocol specifications indicate the range should be to 119, which + * limits maximum year to 2099. But this range has not been checked. + */ +#define SMB_DATE_MAX (127<<9 | 12<<5 | 31) +#define SMB_DATE_MIN (0<<9 | 1<<5 | 1) +#define SMB_TIME_MAX (23<<11 | 59<<5 | 29) + int cifsFYI = 0; bool traceSMB; bool enable_oplocks = true; @@ -142,6 +151,7 @@ cifs_read_super(struct super_block *sb) struct inode *inode; struct cifs_sb_info *cifs_sb; struct cifs_tcon *tcon; + struct timespec64 ts; int rc = 0; cifs_sb = CIFS_SB(sb); @@ -161,6 +171,18 @@ cifs_read_super(struct super_block *sb) /* BB FIXME fix time_gran to be larger for LANMAN sessions */ sb->s_time_gran = 100; + if (tcon->unix_ext) { + ts = cifs_NTtimeToUnix(0); + sb->s_time_min = ts.tv_sec; + ts = cifs_NTtimeToUnix(cpu_to_le64(S64_MAX)); + sb->s_time_max = ts.tv_sec; + } else { + ts = cnvrtDosUnixTm(cpu_to_le16(SMB_DATE_MIN), 0, 0); + sb->s_time_min = ts.tv_sec; + ts = cnvrtDosUnixTm(cpu_to_le16(SMB_DATE_MAX), cpu_to_le16(SMB_TIME_MAX), 0); + sb->s_time_max = ts.tv_sec; + } + sb->s_magic = CIFS_MAGIC_NUMBER; sb->s_op = &cifs_super_ops; sb->s_xattr = cifs_xattr_handlers; diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index ed92958e842d..49c17ee18254 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c @@ -949,8 +949,8 @@ static const int total_days_of_prev_months[] = { struct timespec64 cnvrtDosUnixTm(__le16 le_date, __le16 le_time, int offset) { struct timespec64 ts; - time64_t sec; - int min, days, month, year; + time64_t sec, days; + int min, day, month, year; u16 date = le16_to_cpu(le_date); u16 time = le16_to_cpu(le_time); SMB_TIME *st = (SMB_TIME *)&time; @@ -966,15 +966,15 @@ struct timespec64 cnvrtDosUnixTm(__le16 le_date, __le16 le_time, int offset) sec += 60 * 60 * st->Hours; if (st->Hours > 24) cifs_dbg(VFS, "illegal hours %d\n", st->Hours); - days = sd->Day; + day = sd->Day; month = sd->Month; - if (days < 1 || days > 31 || month < 1 || month > 12) { - cifs_dbg(VFS, "illegal date, month %d day: %d\n", month, days); - days = clamp(days, 1, 31); + if (day < 1 || day > 31 || month < 1 || month > 12) { + cifs_dbg(VFS, "illegal date, month %d day: %d\n", month, day); + day = clamp(day, 1, 31); month = clamp(month, 1, 12); } month -= 1; - days += total_days_of_prev_months[month]; + days = day + total_days_of_prev_months[month]; days += 3652; /* account for difference in days between 1980 and 1970 */ year = sd->Year; days += year * 365; From patchwork Tue Jul 30 01:49:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11064781 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B8A70746 for ; Tue, 30 Jul 2019 01:50:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9C242844B for ; Tue, 30 Jul 2019 01:50:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D8AB28492; Tue, 30 Jul 2019 01:50:36 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 41A072844B for ; Tue, 30 Jul 2019 01:50:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730889AbfG3Bue (ORCPT ); Mon, 29 Jul 2019 21:50:34 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:39276 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730879AbfG3Bue (ORCPT ); Mon, 29 Jul 2019 21:50:34 -0400 Received: by mail-pl1-f194.google.com with SMTP id b7so28260793pls.6; Mon, 29 Jul 2019 18:50:33 -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=Q65KxpxSvZWWFfdRJC2De6rWD4axz3O/fUFw710DcxY=; b=o6RjBpHbSKI6NJ/u5O4m0uEaVg9AQ64I8+mF+jnHsHBxSHRwcniiguLAnigIBOxPKt ZbX5wAEFE2LXx3Gx9JBT7C+MaKtmtwRG80CTUTT/QloCY4i/Az2UA9zjFp2O5wW5/m4k QujryVdAfNVofLgvDZHUQnwSvGD5btbK7RdUyKPh9fi+b4gT8tDdUIsWQHZdcJrEmOxH BhgEE9a/hDUTak2wkcG8vAvVfV2aSlyTWgecQEaqqV1e5ctIdLJb/d88nuuorGukwz9f WxvBi9FNi/iTpqpGSQg83iExL4Wxzb3rAyuD2/Kyy/kYNRtVnYCAAQtPVHu/Ye1q2X2f quWA== 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=Q65KxpxSvZWWFfdRJC2De6rWD4axz3O/fUFw710DcxY=; b=ODA0RwOrGxlq2ujgZ5HO2QdBzJyujgjylflOxXyXxEuOBkG8dqHEePpv1c4uDk1kp1 C1YeEts1IDfG5GkYN22v3+gvl1mjt5nwLqQGjVycFNJYhOyYtuTS62gsJo9Qwvxqldzu p6qJrhOSowtfRMe/M2x5RqFsDikFP2dWIDrzG5dJ6eNpyci8+tDoa+S58LRbEtfFYVk2 CeRJreNokNdrgYmLQjaYS7bWtZb5VeuFFjwN3jk9WELZK1rsorFXA9SE9u2WvtJ4g0lt 4AXkbLKuZDTHjjNzUcwJqqwFWIJARgT7vWdRfkNfy1T7DTPSZ+i+WpuQOemEobyGbHaU 5m1Q== X-Gm-Message-State: APjAAAWV++10b30UPiCAWxQ3PACT3bC/lk54FvKeLu/eakRybt22DSHD r08b05qRfLv5GhSIVOsznHnbeOBSf94= X-Google-Smtp-Source: APXvYqyEpkzMvJTCDY9XVuVH5i9haT6A0BQ+SZpJBIVq1q/uWQbyyODfynIElCuCYC8tz3iQJ6G77Q== X-Received: by 2002:a17:902:e20c:: with SMTP id ce12mr116675854plb.130.1564451433161; Mon, 29 Jul 2019 18:50:33 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id r6sm138807156pjb.22.2019.07.29.18.50.32 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 18:50:32 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org, hirofumi@mail.parknet.co.jp Subject: [PATCH 12/20] fs: fat: Initialize filesystem timestamp ranges Date: Mon, 29 Jul 2019 18:49:16 -0700 Message-Id: <20190730014924.2193-13-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190730014924.2193-1-deepa.kernel@gmail.com> References: <20190730014924.2193-1-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 Fill in the appropriate limits to avoid inconsistencies in the vfs cached inode times when timestamps are outside the permitted range. Some FAT variants indicate that the years after 2099 are not supported. Since commit 7decd1cb0305 ("fat: Fix and cleanup timestamp conversion"), we support the full range of years that can be represented, up to 2107. Signed-off-by: Deepa Dinamani Cc: hirofumi@mail.parknet.co.jp --- fs/fat/inode.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 05689198f5af..5f04c5c810fb 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -31,6 +31,11 @@ #define KB_IN_SECTORS 2 +/* DOS dates from 1980/1/1 through 2107/12/31 */ +#define FAT_DATE_MIN (0<<9 | 1<<5 | 1) +#define FAT_DATE_MAX (127<<9 | 12<<5 | 31) +#define FAT_TIME_MAX (23<<11 | 59<<5 | 29) + /* * A deserialized copy of the on-disk structure laid out in struct * fat_boot_sector. @@ -1605,6 +1610,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, int debug; long error; char buf[50]; + struct timespec64 ts; /* * GFP_KERNEL is ok here, because while we do hold the @@ -1698,6 +1704,12 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, sbi->free_clus_valid = 0; sbi->prev_free = FAT_START_ENT; sb->s_maxbytes = 0xffffffff; + fat_time_fat2unix(sbi, &ts, 0, cpu_to_le16(FAT_DATE_MIN), 0); + sb->s_time_min = ts.tv_sec; + + fat_time_fat2unix(sbi, &ts, cpu_to_le16(FAT_TIME_MAX), + cpu_to_le16(FAT_DATE_MAX), 0); + sb->s_time_max = ts.tv_sec; if (!sbi->fat_length && bpb.fat32_length) { struct fat_boot_fsinfo *fsinfo; From patchwork Tue Jul 30 01:49:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11064801 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 50053746 for ; Tue, 30 Jul 2019 01:51:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F3F528600 for ; Tue, 30 Jul 2019 01:51:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3219028716; Tue, 30 Jul 2019 01:51:32 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 A3A6728600 for ; Tue, 30 Jul 2019 01:51:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731041AbfG3Bv1 (ORCPT ); Mon, 29 Jul 2019 21:51:27 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:46903 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730887AbfG3Bue (ORCPT ); Mon, 29 Jul 2019 21:50:34 -0400 Received: by mail-pg1-f194.google.com with SMTP id k189so10122804pgk.13; Mon, 29 Jul 2019 18:50:34 -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=n3/DjHVGVi/F7aqXCng/e3omBwsQcSJR2eYgFJqv7Mc=; b=MHJi7qDWRMASA2QX3F2ibh+beP9hQfu4y/3XWxnFZrpKupkIBJ7aQg41m49kU4QqxZ e2h5S1+q23g0nf2Z3vFkkxBFads7S8im6K2WahdPuX7rx7O+rUwONCjTxE2hBDr3jP3I t/rN8zsaFDZY1fdh2Ji4f/uUNvUEuEO2GdqrTIRZ69z074luty63vB7VOPbi/IN+Dr02 DkIugKH5IuWRHXxC5yjTrSRjbbYhcJnRhB8MNPd+lHVO9xRmL8MLOZWQkQWo/fzvCkJV S3WCaDQ11GZb4mHYqfO5hLNfgpFn0Au5PhN8BsBl0gQQC5JxqUPOg61Px4p54kb5y+Cf BqbA== 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=n3/DjHVGVi/F7aqXCng/e3omBwsQcSJR2eYgFJqv7Mc=; b=YglheY5XE7NE2A7DhqEATlJiUc/2U1Rtz/bjhstivGaCNRPpDafA3AhaePaEpXG2cm vc6wwPY0ugmNEsZhG2HYkfb/n8xjYuDV06AgN8T2+7kTthK9V1IvQVR+Ragm/iN/UjYx gQyJVjxQ/Jarse5eyd8VVCc13mfyznb4w1AG7STo0RPeT/yCN6kbpMeDNtIjouBF9yb8 CAUD5p1qDXVQrH3KenInMPHoLuIvRYAXur1UXIXLR43ZkFo9S1vJJYzh3cnAeMV5X3iu mBYvllcBiBpUxjZVhhnkYcAc1LlLxIBhqnC3auHuexlRPKzpu1IdUBhIPBMLwj7z7FEI 28QA== X-Gm-Message-State: APjAAAUMP0/Yk72myp+p7n8Aefrlib6CPYjb4RbPMB2u6Yr5VlYu5tO5 +49YhSDZnkdAndi5mqxTfMavPGpK6Gc= X-Google-Smtp-Source: APXvYqw57XCWaQyUqG42LYuM47RZdiFqd+cXrmNyi0MvSlqoJu3ygzgQo+qtS2WAhgSGWrF2osL52Q== X-Received: by 2002:a17:90a:bd8c:: with SMTP id z12mr39695235pjr.60.1564451434099; Mon, 29 Jul 2019 18:50:34 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id r6sm138807156pjb.22.2019.07.29.18.50.33 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 18:50:33 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org, dsterba@suse.com Subject: [PATCH 13/20] fs: affs: Initialize filesystem timestamp ranges Date: Mon, 29 Jul 2019 18:49:17 -0700 Message-Id: <20190730014924.2193-14-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190730014924.2193-1-deepa.kernel@gmail.com> References: <20190730014924.2193-1-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 Fill in the appropriate limits to avoid inconsistencies in the vfs cached inode times when timestamps are outside the permitted range. Also fix timestamp calculation to avoid overflow while converting from days to seconds. Signed-off-by: Deepa Dinamani Cc: dsterba@suse.com Acked-by: David Sterba --- fs/affs/amigaffs.c | 2 +- fs/affs/amigaffs.h | 3 +++ fs/affs/inode.c | 4 ++-- fs/affs/super.c | 4 ++++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c index 14a6c1b90c9f..f708c45d5f66 100644 --- a/fs/affs/amigaffs.c +++ b/fs/affs/amigaffs.c @@ -375,7 +375,7 @@ affs_secs_to_datestamp(time64_t secs, struct affs_date *ds) u32 minute; s32 rem; - secs -= sys_tz.tz_minuteswest * 60 + ((8 * 365 + 2) * 24 * 60 * 60); + secs -= sys_tz.tz_minuteswest * 60 + AFFS_EPOCH_DELTA; if (secs < 0) secs = 0; days = div_s64_rem(secs, 86400, &rem); diff --git a/fs/affs/amigaffs.h b/fs/affs/amigaffs.h index f9bef9056659..81fb396d4dfa 100644 --- a/fs/affs/amigaffs.h +++ b/fs/affs/amigaffs.h @@ -32,6 +32,9 @@ #define AFFS_ROOT_BMAPS 25 +/* Seconds since Amiga epoch of 1978/01/01 to UNIX */ +#define AFFS_EPOCH_DELTA ((8 * 365 + 2) * 86400LL) + struct affs_date { __be32 days; __be32 mins; diff --git a/fs/affs/inode.c b/fs/affs/inode.c index 73598bff8506..a346cf7659f1 100644 --- a/fs/affs/inode.c +++ b/fs/affs/inode.c @@ -150,10 +150,10 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino) } inode->i_mtime.tv_sec = inode->i_atime.tv_sec = inode->i_ctime.tv_sec - = (be32_to_cpu(tail->change.days) * (24 * 60 * 60) + + = (be32_to_cpu(tail->change.days) * 86400LL + be32_to_cpu(tail->change.mins) * 60 + be32_to_cpu(tail->change.ticks) / 50 + - ((8 * 365 + 2) * 24 * 60 * 60)) + + AFFS_EPOCH_DELTA) + sys_tz.tz_minuteswest * 60; inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec = inode->i_atime.tv_nsec = 0; affs_brelse(bh); diff --git a/fs/affs/super.c b/fs/affs/super.c index e7d036efbaa1..cc463ae47c12 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c @@ -355,6 +355,10 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) sb->s_op = &affs_sops; sb->s_flags |= SB_NODIRATIME; + sb->s_time_gran = NSEC_PER_SEC; + sb->s_time_min = sys_tz.tz_minuteswest * 60 + AFFS_EPOCH_DELTA; + sb->s_time_max = 86400LL * U32_MAX + 86400 + sb->s_time_min; + sbi = kzalloc(sizeof(struct affs_sb_info), GFP_KERNEL); if (!sbi) return -ENOMEM; From patchwork Tue Jul 30 01:49:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11064783 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 107FF112C for ; Tue, 30 Jul 2019 01:50:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 023772844B for ; Tue, 30 Jul 2019 01:50:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EAEF328492; Tue, 30 Jul 2019 01:50: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 9769D2844B for ; Tue, 30 Jul 2019 01:50:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730902AbfG3Buh (ORCPT ); Mon, 29 Jul 2019 21:50:37 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:40770 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730848AbfG3Bug (ORCPT ); Mon, 29 Jul 2019 21:50:36 -0400 Received: by mail-pf1-f195.google.com with SMTP id p184so28939008pfp.7; Mon, 29 Jul 2019 18:50:35 -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=Yus3UESewstQeP6xBqn0c8tU9AnJsLA523aHx91as5s=; b=SEiA+6DXUY8nU4JxxRcvILAhfCyQ812nRVCkzqt6XOkyQhJUxSD9nZOCDqD09aXxnP 8R9W+2OaX65xIoHL7hc89glmAE+6JmpxEhamDtnMtuxBqI41Ve4dY8vwevEuvYidaP5H dVdhr9c2V45rbKJF8LjovcLCNUc8ix+/hS+hN8isukEoIIjSR6KxuQvBwB/pOAOQa7g7 kypBuCvFNYFZV8nOxcjFPButxRxD4V3m/kwIF0gdHPMDjcCD+eluBD7penp75YA/GaeC 3fTE8s3nUCTR/b403KpScgWpdbP11kRswyt/ElBYo5dd1JjF8qR7vzPU4iPwKETBehhK nsxw== 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=Yus3UESewstQeP6xBqn0c8tU9AnJsLA523aHx91as5s=; b=OW1o94OoznGeDYbHFbc5NU0/wbNt7hYTuZGRryDjiinG5P0Uw+h4qnJ09f6JBGS/sS /UqPfoGYNsOlCrToU6VnUg5nhMGV2bUjZq2qZLNqrYPPcJwxkSnIa3wrMmBbnx1701+0 x8GOVRDp9fi8T+ku5njVkpHJoCliOU1nwVX0dTj38LyKpk9MTpfynLSSB09Q3WdxWlqQ GqRO69RN/uu7JRQg+eSTAPPd1DsHU8VhYQE6m5jp4aBJEstHoOeJ1eZWoUDoSwCdioRB Zom5FQz1Uj5/bSlXAePctzhxMAKBvzbrWFuuzCja9SavJC8c90UBlY967Rf6BjHMan6K 3YfQ== X-Gm-Message-State: APjAAAWaY3CfyUfnc+E/a91bShwRWttqaBvN4AJVw7FRzCLLXnx8Oe7a F2XVUZKTK0YvMlghHIszK8M= X-Google-Smtp-Source: APXvYqy5JQbCWDUYQpBFr2nhGCvc2pEAyEn23IjvOJzC/OFOcCnF/y/pvQmApBMVM5vLDLwlxUTQbA== X-Received: by 2002:a62:27c2:: with SMTP id n185mr30133871pfn.79.1564451435056; Mon, 29 Jul 2019 18:50:35 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id r6sm138807156pjb.22.2019.07.29.18.50.34 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 18:50:34 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org, hch@infradead.org Subject: [PATCH 14/20] fs: sysv: Initialize filesystem timestamp ranges Date: Mon, 29 Jul 2019 18:49:18 -0700 Message-Id: <20190730014924.2193-15-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190730014924.2193-1-deepa.kernel@gmail.com> References: <20190730014924.2193-1-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 Fill in the appropriate limits to avoid inconsistencies in the vfs cached inode times when timestamps are outside the permitted range. Signed-off-by: Deepa Dinamani Cc: hch@infradead.org --- fs/sysv/super.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/sysv/super.c b/fs/sysv/super.c index d788b1daa7eb..cc8e2ed155c8 100644 --- a/fs/sysv/super.c +++ b/fs/sysv/super.c @@ -368,7 +368,8 @@ static int sysv_fill_super(struct super_block *sb, void *data, int silent) sbi->s_block_base = 0; mutex_init(&sbi->s_lock); sb->s_fs_info = sbi; - + sb->s_time_min = 0; + sb->s_time_max = U32_MAX; sb_set_blocksize(sb, BLOCK_SIZE); for (i = 0; i < ARRAY_SIZE(flavours) && !size; i++) { @@ -487,6 +488,8 @@ static int v7_fill_super(struct super_block *sb, void *data, int silent) sbi->s_type = FSTYPE_V7; mutex_init(&sbi->s_lock); sb->s_fs_info = sbi; + sb->s_time_min = 0; + sb->s_time_max = U32_MAX; sb_set_blocksize(sb, 512); From patchwork Tue Jul 30 01:49:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11064799 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EADB9112C for ; Tue, 30 Jul 2019 01:51:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCBB028600 for ; Tue, 30 Jul 2019 01:51:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D131528714; Tue, 30 Jul 2019 01:51:25 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 8F55D28600 for ; Tue, 30 Jul 2019 01:51:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731026AbfG3BvU (ORCPT ); Mon, 29 Jul 2019 21:51:20 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:46298 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730896AbfG3Bug (ORCPT ); Mon, 29 Jul 2019 21:50:36 -0400 Received: by mail-pl1-f195.google.com with SMTP id c2so28186764plz.13; Mon, 29 Jul 2019 18:50:36 -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=Znhv/kCRKUKHxOSXZDgniqB5ZIlr3K3JgxSCaFgdq+8=; b=mnDSVL3M6bAosUcHnoza2f8m7wEnumxSt3YvGoUwcyJEmuWgQSvjnGlgb6izTn97XH WlFFapP2gmybE/zhqdO56mykLwgimYu1v8UaIwPDFvTopkNnSPYzV9cwr9xzQwpBzJ+p Xg7xneetDXkvGpv8ehyjx/7htK1NAH+7+vyXX9E211v+GFQOZg4QBoJmL7Pzfptp5ZK0 i8X5jSa/Y3pDBHXBrJcfSHV1vsty9muNkpfrva7etLeNSAQwVwVB/OF+4yE/1WEZx98j iarZwuS3V9vHIWqKPxNVa06nGj40Yu6RIznPCIObhC5bzPqBwZ7S5WW2D/fAxwiUL+0A 0k5A== 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=Znhv/kCRKUKHxOSXZDgniqB5ZIlr3K3JgxSCaFgdq+8=; b=dpqVC4dbNPzCjm4hCPMwACxEj517CIh3RalvAMWQ0iHC2ymwqZUNXqVAwwWWw+5ntq GDe504U1aYhdU4pIra8S7pqw+YEMp8lAiLt6lmEid2Xo+N9IiM9gnTg/2Qo1+2fPJWod kFjRGqhHBlj/9HZfwvdxZOlo9l/cDJV9o6U1zPJnU4BBB7E9ldr09+jqyC+kiiZfq4N+ w6eXxzBnXQONzP9wG/INN2/MV83Q+djtLMHlKb4x5kUmFxV8xCS3xqDH/RC1KBwzP7G4 33hXRNqzHelozEDd8o38lrVPAmSH7GdKJ+EMry7lePxOViiGbrX3PEs1VzaXFkEZ9CEo EoYA== X-Gm-Message-State: APjAAAXp0HgVcrYFCkWh4oS1dIauxQ2XvdxcB32b5cu14SatdlaXc6Qg QRe1LNAvrHYNVcTCLgmC4xSKms6YkWs= X-Google-Smtp-Source: APXvYqw5bUkSyOBiAJcIYvdeq+xCu//0ZThr2vJrAZqPxC+L2tzGlmqjAahHtHiCjAClQuPYpNrDLw== X-Received: by 2002:a17:902:110b:: with SMTP id d11mr117757847pla.213.1564451436018; Mon, 29 Jul 2019 18:50:36 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id r6sm138807156pjb.22.2019.07.29.18.50.35 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 18:50:35 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org, zyan@redhat.com, sage@redhat.com, idryomov@gmail.com, ceph-devel@vger.kernel.org Subject: [PATCH 15/20] fs: ceph: Initialize filesystem timestamp ranges Date: Mon, 29 Jul 2019 18:49:19 -0700 Message-Id: <20190730014924.2193-16-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190730014924.2193-1-deepa.kernel@gmail.com> References: <20190730014924.2193-1-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 Fill in the appropriate limits to avoid inconsistencies in the vfs cached inode times when timestamps are outside the permitted range. According to the disscussion in https://patchwork.kernel.org/patch/8308691/ we agreed to use unsigned 32 bit timestamps on ceph. Update the limits accordingly. Signed-off-by: Deepa Dinamani Cc: zyan@redhat.com Cc: sage@redhat.com Cc: idryomov@gmail.com Cc: ceph-devel@vger.kernel.org --- fs/ceph/super.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/ceph/super.c b/fs/ceph/super.c index d57fa60dcd43..6cf3a4fceac1 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -981,6 +981,8 @@ static int ceph_set_super(struct super_block *s, void *data) s->s_export_op = &ceph_export_ops; s->s_time_gran = 1000; /* 1000 ns == 1 us */ + s->s_time_min = 0; + s->s_time_max = U32_MAX; ret = set_anon_super(s, NULL); /* what is that second arg for? */ if (ret != 0) From patchwork Tue Jul 30 01:49:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11064795 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D0A1E746 for ; Tue, 30 Jul 2019 01:51:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1A6228600 for ; Tue, 30 Jul 2019 01:51:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5BD028714; Tue, 30 Jul 2019 01:51:11 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 48C3728600 for ; Tue, 30 Jul 2019 01:51:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731006AbfG3BvK (ORCPT ); Mon, 29 Jul 2019 21:51:10 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:33457 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730900AbfG3Buh (ORCPT ); Mon, 29 Jul 2019 21:50:37 -0400 Received: by mail-pg1-f194.google.com with SMTP id f20so19935370pgj.0; Mon, 29 Jul 2019 18:50:37 -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=2pzcazUl/YPKOksb7vbUDmWoTVBPfLTioSqOrhqez9Y=; b=pLw9p0nt0hUU7YWjb96e0yxgbLIaZW3MxiGngSf7VlziEjgE3XYrQpkwVaK9yDBbKZ Zh15d7rg5YUakKBN8gZARrsLnY2tm4Zd0XabmRrln1L7IJL5PBbNCUbrg0nJ35oOmQwu M4uoxxYroyZpW+Io7Lc2Kjx5snWpyeHkcGTMMguW+EwimhSS34kane0RA/t87gz/BVkk 7KQP3+dAfeHoCVF9pi6M+/1hvr1yhCmcigOyOd1yTca9pXr4oJQBPyrYClPiM/2gIWgL miFY53BeQJz1qpTxfSfEGtGYMrA7luW27vw0WhaXKs3o3BKSDGR/FYdihKvOVDdOIMrv wwDA== 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=2pzcazUl/YPKOksb7vbUDmWoTVBPfLTioSqOrhqez9Y=; b=BSSTCJiW49MSPXuWKZEJ3fbvpsVP9cU12ZTLuZiHoUXXCT58NADXf5CRCvhcu1qzoq t0w0JHtesADYmvWtPMR4/SQWyXl5QPCA8HUN9v3ESMArtvgLsvOspy0oJIKCAArN0wK+ ZjVnMeRNFg8zuJEjTPNKHcKsnjOv2MP6+E3HMArNDFqV+NLUxFUKuYSRqkgQ7c2d8LtL L03T6UZ6CS7ZQcRw25i34XSaAwujxGxZdrlfX21c304RXAYVHnjGEgwFp4fO0H/jygPp pZiWU7wIePvWNg3Kg6tSvDHlL7X+rCzbU6CwAJNvMJ2R8OOEhZHV1WSrMywdKdpSeP7h Mn9w== X-Gm-Message-State: APjAAAVP7fqZwGhZYpldoj6QFbEuBBKz7ati4OmvbOw8voqAOEZ1BkjU 2jm727DpmAqJf5B6ZbKXVyc= X-Google-Smtp-Source: APXvYqwuoNCFskzA7wwr+3fhcEUFUPA856yNJ6Zox7fqtsa9eOMvdD4IodszPXes+qaudx93RAiWMA== X-Received: by 2002:a62:cec4:: with SMTP id y187mr39052123pfg.84.1564451437010; Mon, 29 Jul 2019 18:50:37 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id r6sm138807156pjb.22.2019.07.29.18.50.36 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 18:50:36 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org, hubcap@omnibond.com, martin@omnibond.com, devel@lists.orangefs.org Subject: [PATCH 16/20] fs: orangefs: Initialize filesystem timestamp ranges Date: Mon, 29 Jul 2019 18:49:20 -0700 Message-Id: <20190730014924.2193-17-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190730014924.2193-1-deepa.kernel@gmail.com> References: <20190730014924.2193-1-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 Fill in the appropriate limits to avoid inconsistencies in the vfs cached inode times when timestamps are outside the permitted range. Assume the limits as unsigned according to the below commit 98e8eef557a9 ("changed PVFS_time from int64_t to uint64_t") in https://github.com/waltligon/orangefs Author: Neill Miller Date: Thu Sep 2 15:00:38 2004 +0000 Signed-off-by: Deepa Dinamani Cc: hubcap@omnibond.com Cc: martin@omnibond.com Cc: devel@lists.orangefs.org --- fs/orangefs/super.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c index ee5efdc35cc1..dcd97e8158b1 100644 --- a/fs/orangefs/super.c +++ b/fs/orangefs/super.c @@ -439,6 +439,8 @@ static int orangefs_fill_sb(struct super_block *sb, sb->s_blocksize = PAGE_SIZE; sb->s_blocksize_bits = PAGE_SHIFT; sb->s_maxbytes = MAX_LFS_FILESIZE; + sb->s_time_min = 0; + sb->s_time_max = S64_MAX; ret = super_setup_bdi(sb); if (ret) From patchwork Tue Jul 30 01:49:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11064793 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0E3F6746 for ; Tue, 30 Jul 2019 01:51:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0001528600 for ; Tue, 30 Jul 2019 01:51:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E890128714; Tue, 30 Jul 2019 01:51:10 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 8B67828600 for ; Tue, 30 Jul 2019 01:51:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731001AbfG3BvJ (ORCPT ); Mon, 29 Jul 2019 21:51:09 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:39280 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730906AbfG3Bui (ORCPT ); Mon, 29 Jul 2019 21:50:38 -0400 Received: by mail-pl1-f193.google.com with SMTP id b7so28260864pls.6; Mon, 29 Jul 2019 18:50:38 -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=vRAjF3ngnOVHXNvH9bSrKw90+Pov0J0fPixsHFf+DcE=; b=ofUSxfq0NNCSkunC42cARiexTJOCOAZOomxJZm4Gp0xxxyQkU53RfdiYnHVHkcT2ne J89UJangegGrtLCIKPd5OMejojIN3HQvLj8YU6WLHj9xwxJOpiZ9v/X8p61RsuUxuoUt izdj5rMkVHtk4xFKeiqcAAypx6QKLtKZUjRKUzwaoXO5UQKC0xlzVewiQmz7wHsuU9ZV kQGf6DyNv2LRnwXHg+D+mwr75WTAZSi6iE2QXN842Kjhr6Zl4PH0UU2DetlDSMD7sAY4 VLXDg6awV8iGek2QLKzgMhjuwt5Q4F1Lbtxuzv1OT3JKwwAfWlASLPgWOGVMdFnLd8NU vVjg== 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=vRAjF3ngnOVHXNvH9bSrKw90+Pov0J0fPixsHFf+DcE=; b=uLqxFj3KlWFGthO/tKhGldMqUBAnMs7SNTfv1XcCznfWpPwO6Wk0geLiUTVCwwRBsP ylz0BS/5XAodWkwe42LxlfyPdTzb9Q/iBmiN2TO2VVXexoT4YxdjRLzfgyL8710KoUEH fOk5FxySK57o9Hjymu07oGMT8ZgwDPxYdN9FPpISb982ErryNcDduCwwRH2CNAtEdk1Y U3PM9zFtNA/A3dJVltRSdyKFCxw3GGlzkAFbQVkR3DU6eG0mbARYouZnn92aW/aI76Vz VYBZXGIQPHWAkc0vwy72Q/oS6+gO38Ju++xfHVeUgGbfU3e29Y1Kv4tdvFJ2D7hcB2PC uP/w== X-Gm-Message-State: APjAAAV12VzW3cVx2rRU0jhgbxfJPlQZ5UewQ/9ja93gWuuVb1Kc8YN1 sOjMYT2jxKd2/LN9apC1RmQ= X-Google-Smtp-Source: APXvYqz7D6pDOWc0L3BqSTp+/0hcx3918pfbY+fYng6mc3GNhPDrGfd1ne1TSDjxNaep1J5KAeDX7A== X-Received: by 2002:a17:902:ff05:: with SMTP id f5mr109207646plj.116.1564451437936; Mon, 29 Jul 2019 18:50:37 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id r6sm138807156pjb.22.2019.07.29.18.50.37 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 18:50:37 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org, mikulas@artax.karlin.mff.cuni.cz Subject: [PATCH 17/20] fs: hpfs: Initialize filesystem timestamp ranges Date: Mon, 29 Jul 2019 18:49:21 -0700 Message-Id: <20190730014924.2193-18-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190730014924.2193-1-deepa.kernel@gmail.com> References: <20190730014924.2193-1-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 Fill in the appropriate limits to avoid inconsistencies in the vfs cached inode times when timestamps are outside the permitted range. Also change the local_to_gmt() to use time64_t instead of time32_t. Signed-off-by: Deepa Dinamani Cc: mikulas@artax.karlin.mff.cuni.cz --- fs/hpfs/hpfs_fn.h | 6 ++---- fs/hpfs/super.c | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h index ab2e7cc2ff33..1cca83218fb5 100644 --- a/fs/hpfs/hpfs_fn.h +++ b/fs/hpfs/hpfs_fn.h @@ -334,7 +334,7 @@ long hpfs_ioctl(struct file *file, unsigned cmd, unsigned long arg); * local time (HPFS) to GMT (Unix) */ -static inline time64_t local_to_gmt(struct super_block *s, time32_t t) +static inline time64_t local_to_gmt(struct super_block *s, time64_t t) { extern struct timezone sys_tz; return t + sys_tz.tz_minuteswest * 60 + hpfs_sb(s)->sb_timeshift; @@ -343,9 +343,7 @@ static inline time64_t local_to_gmt(struct super_block *s, time32_t t) static inline time32_t gmt_to_local(struct super_block *s, time64_t t) { extern struct timezone sys_tz; - t = t - sys_tz.tz_minuteswest * 60 - hpfs_sb(s)->sb_timeshift; - - return clamp_t(time64_t, t, 0, U32_MAX); + return t - sys_tz.tz_minuteswest * 60 - hpfs_sb(s)->sb_timeshift; } static inline time32_t local_get_seconds(struct super_block *s) diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index 9db6d84f0d62..0a677a9aaf34 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c @@ -614,6 +614,8 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) s->s_magic = HPFS_SUPER_MAGIC; s->s_op = &hpfs_sops; s->s_d_op = &hpfs_dentry_operations; + s->s_time_min = local_to_gmt(s, 0); + s->s_time_max = local_to_gmt(s, U32_MAX); sbi->sb_root = le32_to_cpu(superblock->root); sbi->sb_fs_size = le32_to_cpu(superblock->n_sectors); From patchwork Tue Jul 30 01:49:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11064791 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 59A43746 for ; Tue, 30 Jul 2019 01:51:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46CC228600 for ; Tue, 30 Jul 2019 01:51:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 36F7A28714; Tue, 30 Jul 2019 01:51:09 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 D8C8B28600 for ; Tue, 30 Jul 2019 01:51:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730988AbfG3BvF (ORCPT ); Mon, 29 Jul 2019 21:51:05 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:37831 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730909AbfG3Buj (ORCPT ); Mon, 29 Jul 2019 21:50:39 -0400 Received: by mail-pl1-f196.google.com with SMTP id b3so28239426plr.4; Mon, 29 Jul 2019 18:50:39 -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=1RF9tSxg4ftPaCa44wQSYVO8OxIT8+s62dDQIN7bX2o=; b=iEU9KPKEpUOeQc+TDqw/j8EP61bJbMSCI7uNc6Xdq7LWM74Uy1YzbFeoOmrAwxgSNo Ay+T+mES8hCLhp7bAwoC6cNDFauOvqOKRflK8MpN3lRzXW38Qo6IFTbh8Zhz3FkSveuo h+pnt/9QISKNzrEL//VZ6KZp5mmpTnX6FZ0Vgi1PB6wn1B8qQkSdsGK8X5dgHsRTT/Se 9SsWbtD9Abw8gA3Xxi5lzsPoCXgL+5sRVQezJJK8gOTmAyWdPJ1cdqIwdcSXUCQQWL3h mGhI3EpiMtJuauLsd7nYM23xklau+V7734ZHdWkigGIj+iNIxHPEDqWqFKgU1F2nQt3H ZWWA== 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=1RF9tSxg4ftPaCa44wQSYVO8OxIT8+s62dDQIN7bX2o=; b=LYm062RJVh+eTaIIZLex6Z3hqE1h0jiF7sifGVzE30Rb5MdrNXvZlN4cwvPbPa5Tsz DFgU30+Ejbqf8wJaOg5pU2dERBHbUPqwrJ9/dmKLAezw0l/gkUNbhwu1jVfpVGdE2pSN jHSZ40yQ/Z6iuVuabglXhYbcmzvs5VCpZ5mZUnQ+xNLeQ/QC8W+mjYouYn7J1h7ps3M+ 3OsQz4dCaV2sy5OW42/OQfUqrBX/KztW3khrHC2D7g01XmJtBzEYcSVsTKbaLb2slxwL PuC6FXw84BC2cscM82DJfnwk3nGQYHiKtzcY5bJ3qmcdRK6DEWCxi5OiriuPS26WR3a9 8xYA== X-Gm-Message-State: APjAAAW2Phsz2JflbQSTX61/uJttCzTuHEt5sFPIMIHQRV1kWEdlqUyL UOyF8mUM0izVuo4W9qpGm3c= X-Google-Smtp-Source: APXvYqwbh2HCKG+rqxkUOX27ALuwe+xOKD139Cl19RTPM9CGSWVCglZ7EgjUivdAahWtSXC/XiaSDA== X-Received: by 2002:a17:902:6b81:: with SMTP id p1mr109757855plk.91.1564451438988; Mon, 29 Jul 2019 18:50:38 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id r6sm138807156pjb.22.2019.07.29.18.50.37 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 18:50:38 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org, me@bobcopeland.com, linux-karma-devel@lists.sourceforge.net Subject: [PATCH 18/20] fs: omfs: Initialize filesystem timestamp ranges Date: Mon, 29 Jul 2019 18:49:22 -0700 Message-Id: <20190730014924.2193-19-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190730014924.2193-1-deepa.kernel@gmail.com> References: <20190730014924.2193-1-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 Fill in the appropriate limits to avoid inconsistencies in the vfs cached inode times when timestamps are outside the permitted range. Signed-off-by: Deepa Dinamani Cc: me@bobcopeland.com Cc: linux-karma-devel@lists.sourceforge.net Acked-by: Bob Copeland --- fs/omfs/inode.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c index 08226a835ec3..b76ec6b88ded 100644 --- a/fs/omfs/inode.c +++ b/fs/omfs/inode.c @@ -478,6 +478,10 @@ static int omfs_fill_super(struct super_block *sb, void *data, int silent) sb->s_maxbytes = 0xffffffff; + sb->s_time_gran = NSEC_PER_MSEC; + sb->s_time_min = 0; + sb->s_time_max = U64_MAX / MSEC_PER_SEC; + sb_set_blocksize(sb, 0x200); bh = sb_bread(sb, 0); From patchwork Tue Jul 30 01:49:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11064787 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 14B83746 for ; Tue, 30 Jul 2019 01:50:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3E9128468 for ; Tue, 30 Jul 2019 01:50:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E49A6284B9; Tue, 30 Jul 2019 01:50: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 86D9F28468 for ; Tue, 30 Jul 2019 01:50:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730955AbfG3Buv (ORCPT ); Mon, 29 Jul 2019 21:50:51 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:42249 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730911AbfG3Buk (ORCPT ); Mon, 29 Jul 2019 21:50:40 -0400 Received: by mail-pl1-f194.google.com with SMTP id ay6so28254432plb.9; Mon, 29 Jul 2019 18:50:40 -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=2ZSThE50NNeqhGeatQJKVePoQLkvHh5lNhLyxKc+P10=; b=G/sRwmaWmQYl7mNyCUU4QUj5B6N3VaV1fxKTTDTNh1nNyTteIy7banRQTi7zWMIiq6 aasftDWeoTUZF9zqIVJSbqB8TfCk50NmbinX/dIRBEQ9pLaNYRqynThGYnGsMpjPhNqD 82pYQVfZcgVHrAg2l20u7bYK92+prDKCuFC4BsoVC0o/mqfy6iVphKr6eTuhT7tbkQyv 8Q3ZBH7oPtXLJKuMiaaqnWuJN70WcH+epSsSBPpqwQRTczQWwsJbRobUJTI9QQ9JwMKY Cvjvh9inU3A4WoiwHMTNOtpie6kfHxH6GXMcnn4g03zohvAjTH3Cem3zkS11Ombsifci 2low== 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=2ZSThE50NNeqhGeatQJKVePoQLkvHh5lNhLyxKc+P10=; b=Am6C+RMkQ85RXlN1vW4aatjQoG59vPnf3BBwDXQkNoxwV7pQ/znGRL5L1MphipDQZ8 hcu/kAvvqrunUgocSZD5H3hgRNTa5bK2+uVL9pA3E3pFIsyXAfHH9MM0v99LhU4JahqH G7pdiRQixJ66ihfGwvZ9cSUDIJk3Caw05fZPDVEBNehqGBl3lY5o/olGx359DoU7Gx1u CI7ophk0N/tvyIKnlXKqvCOu3dKmEZms9oOujwPR7vF+wL4P0BSzk3qDykbhbB9E0Y0H GCiD6myKa/4wEYb5egscO34tsB8/9lP2dUjyOPQy9mRYY489CFinEbOq4WtggPoI9LAt OoNQ== X-Gm-Message-State: APjAAAW+kmDz+7chPZCNes7LaYQbSxssVc1uRuyatAVNmykUxzLzWx2r l4kgYQe5QsEBiQmDptlgX+M= X-Google-Smtp-Source: APXvYqzPSFQCjcYcdyjouStI1bcFGux0Ndao/REHUqNGuDSyZqW0Iz/8Z4xiR8hnOnkPDpeu+z6v4g== X-Received: by 2002:a17:902:ba96:: with SMTP id k22mr115650959pls.44.1564451440013; Mon, 29 Jul 2019 18:50:40 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id r6sm138807156pjb.22.2019.07.29.18.50.39 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 18:50:39 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org, anton@enomsg.org, ccross@android.com, keescook@chromium.org, tony.luck@intel.com Subject: [PATCH 19/20] pstore: fs superblock limits Date: Mon, 29 Jul 2019 18:49:23 -0700 Message-Id: <20190730014924.2193-20-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190730014924.2193-1-deepa.kernel@gmail.com> References: <20190730014924.2193-1-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 Also update the gran since pstore has microsecond granularity. Signed-off-by: Deepa Dinamani Cc: anton@enomsg.org Cc: ccross@android.com Cc: keescook@chromium.org Cc: tony.luck@intel.com Acked-by: Kees Cook --- fs/pstore/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index 89a80b568a17..ee752f9fda57 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c @@ -388,7 +388,9 @@ static int pstore_fill_super(struct super_block *sb, void *data, int silent) sb->s_blocksize_bits = PAGE_SHIFT; sb->s_magic = PSTOREFS_MAGIC; sb->s_op = &pstore_ops; - sb->s_time_gran = 1; + sb->s_time_gran = NSEC_PER_USEC; + sb->s_time_min = S64_MIN; + sb->s_time_max = S64_MAX; parse_options(data); From patchwork Tue Jul 30 01:49:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 11064789 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DDCA5112C for ; Tue, 30 Jul 2019 01:51:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CBA7928468 for ; Tue, 30 Jul 2019 01:51:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD00D284B9; Tue, 30 Jul 2019 01:51:04 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 5A33328468 for ; Tue, 30 Jul 2019 01:51:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730947AbfG3Buv (ORCPT ); Mon, 29 Jul 2019 21:50:51 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:36624 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730918AbfG3Bul (ORCPT ); Mon, 29 Jul 2019 21:50:41 -0400 Received: by mail-pl1-f193.google.com with SMTP id k8so28231701plt.3; Mon, 29 Jul 2019 18:50:41 -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=B53kfNAL5bPehU6SpckbeuA1BwDTxczPn/Y5JPnbD6I=; b=eltNGhHdxejXM79qXFqifZMz3c9fD/tHWJqdYrJnjpWpRXTApoIF6g3lgi8ELjYpkm WuD26NHfwxy2wLBeTgJHcAw5qX6l1WaxdGOZupq1cjJ6QHBlqGIyuz20MTzaO5M3PTin G8jAkZ36iwHdVjHvXowRGWPGjBqjXCALDnj1IDslzPEUwXWSyiLjgFI8xgGOBtglRzBM VndPR4HjWJMnQZKKn5dX3CPnddEaxI0TNj8m4dANAY5db6oTtrPvlAAltRadS9wZ7jwN kdwxg9HM3PF39JUUhGkmI5Ul8vcYxCfuVZCOXbAJOH4tAVZZArwflc5KsohHLjSuLpVp 5Crg== 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=B53kfNAL5bPehU6SpckbeuA1BwDTxczPn/Y5JPnbD6I=; b=ejau2OOcjCEtEYmnpVsBnndw2KLoeXbQY7GoRV8JX07d7yPdIL9u9RFNlgbIf6m2hJ UOz26O3321H24MlJl/N6RLMXhMEUVrzV5Oa+nEQZfDmXZnhk9xQ3tW1RdU37X2LyEQv2 iaypv32jcsZUyrkY7R04Sq9fVjLCATsKcxYr7mIJE8Bb3fHGBVLibk4ZEppmCIN7Po6U QlpT9Iubd0+7+xY7oaR3R0rIC4sbNywgSQSCHdQWaU6SzprjqU7kjy5xtiQkwdeYeGJs Css7RHLDPD8NTwldnq1wUUdsAKtR6NpxDDlARX1MDla78fM2z0RuZxsJkVQekvYOrejl APfA== X-Gm-Message-State: APjAAAVgT56f0Ai0PguXo9gmQ1+OjZTVSB8bL95HVsRehFf0SiagkFP9 j9Q9OUaA9MfrlJyTKMngIDo= X-Google-Smtp-Source: APXvYqzBrmFYzI1gA3MEAy0sqbGPWC4ZXkGLgmkSkfkzYyNBaIrlOjsnhxJve8s7Brg31n/F6xooVw== X-Received: by 2002:a17:902:2d01:: with SMTP id o1mr115526266plb.105.1564451440882; Mon, 29 Jul 2019 18:50:40 -0700 (PDT) Received: from deepa-ubuntu.lan (c-98-234-52-230.hsd1.ca.comcast.net. [98.234.52.230]) by smtp.gmail.com with ESMTPSA id r6sm138807156pjb.22.2019.07.29.18.50.40 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 18:50:40 -0700 (PDT) From: Deepa Dinamani To: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, arnd@arndb.de, y2038@lists.linaro.org Subject: [PATCH 20/20] isofs: Initialize filesystem timestamp ranges Date: Mon, 29 Jul 2019 18:49:24 -0700 Message-Id: <20190730014924.2193-21-deepa.kernel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190730014924.2193-1-deepa.kernel@gmail.com> References: <20190730014924.2193-1-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 Fill in the appropriate limits to avoid inconsistencies in the vfs cached inode times when timestamps are outside the permitted range. Reference: http://www.ecma-international.org/publications/standards/Ecma-119.htm Signed-off-by: Deepa Dinamani --- fs/isofs/inode.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index 9e30d8703735..62c0462dc89f 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c @@ -30,6 +30,9 @@ #include "isofs.h" #include "zisofs.h" +/* max tz offset is 13 hours */ +#define MAX_TZ_OFFSET (52*15*60) + #define BEQUIET static int isofs_hashi(const struct dentry *parent, struct qstr *qstr); @@ -801,6 +804,10 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent) */ s->s_maxbytes = 0x80000000000LL; + /* ECMA-119 timestamp from 1900/1/1 with tz offset */ + s->s_time_min = mktime64(1900, 1, 1, 0, 0, 0) - MAX_TZ_OFFSET; + s->s_time_max = mktime64(U8_MAX+1900, 12, 31, 23, 59, 59) + MAX_TZ_OFFSET; + /* Set this for reference. Its not currently used except on write which we don't have .. */