From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lithops.sigma-star.at ([195.201.40.130]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fZzki-00053Y-IX for linux-mtd@lists.infradead.org; Mon, 02 Jul 2018 14:24:29 +0000 From: Richard Weinberger To: Arnd Bergmann Cc: Artem Bityutskiy , Adrian Hunter , y2038@lists.linaro.org, Deepa Dinamani , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ubifs: tnc: use monotonic znode timestamp Date: Mon, 02 Jul 2018 16:24:15 +0200 Message-ID: <31916482.81kKL2104G@blindfold> In-Reply-To: <20180620082937.719067-1-arnd@arndb.de> References: <20180620082937.719067-1-arnd@arndb.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Arnd, Am Mittwoch, 20. Juni 2018, 10:29:11 CEST schrieb Arnd Bergmann: > The tnc uses get_seconds() based timestamps to check the age of a znode, > which has two problems: on 32-bit architectures this may overflow in > 2038 or 2106, and it gives incorrect information when the system time > is updated using settimeofday(). > > Using montonic timestamps with ktime_get_seconds() solves both thes > problems. > > Signed-off-by: Arnd Bergmann > --- > fs/ubifs/shrinker.c | 2 +- > fs/ubifs/tnc.c | 4 ++-- > fs/ubifs/tnc_misc.c | 2 +- > fs/ubifs/ubifs.h | 2 +- > 4 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/fs/ubifs/shrinker.c b/fs/ubifs/shrinker.c > index 9a9fb94a41c6..9d10cbdec2cc 100644 > --- a/fs/ubifs/shrinker.c > +++ b/fs/ubifs/shrinker.c > @@ -71,7 +71,7 @@ static int shrink_tnc(struct ubifs_info *c, int nr, int age, int *contention) > { > int total_freed = 0; > struct ubifs_znode *znode, *zprev; > - int time = get_seconds(); > + time64_t time = ktime_get_seconds(); ubifs does abs(time - znode->time) >= age) { Is this still legit with time64_t? Thanks, //richard