linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Artem Bityutskiy <dedekind1@gmail.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	y2038@lists.linaro.org, Deepa Dinamani <deepa.kernel@gmail.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ubifs: tnc: use monotonic znode timestamp
Date: Tue, 03 Jul 2018 09:28:56 +0200	[thread overview]
Message-ID: <58899545.Szx3E6bSux@blindfold> (raw)
In-Reply-To: <31916482.81kKL2104G@blindfold>

Am Montag, 2. Juli 2018, 16:24:15 CEST schrieb Richard Weinberger:
> 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 <arnd@arndb.de>
> > ---
> >  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?

Answering my own question, yes.
abs() seems to be able to deal with 64bit numbers and time64_t is just a number.

Thanks,
//richard

      reply	other threads:[~2018-07-03  7:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-20  8:29 [PATCH] ubifs: tnc: use monotonic znode timestamp Arnd Bergmann
2018-07-02 14:24 ` Richard Weinberger
2018-07-03  7:28   ` Richard Weinberger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58899545.Szx3E6bSux@blindfold \
    --to=richard@nod.at \
    --cc=adrian.hunter@intel.com \
    --cc=arnd@arndb.de \
    --cc=dedekind1@gmail.com \
    --cc=deepa.kernel@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=y2038@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).