Linux filesystem development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, fengguang.wu@intel.com
Subject: Re: [PATCH] writeback: guard against jiffies wraparound on inode->dirtied_when checks (try #3)
Date: Wed, 1 Apr 2009 17:26:30 -0400	[thread overview]
Message-ID: <20090401172630.31c6ac7c@tleilax.poochiereds.net> (raw)
In-Reply-To: <87y6ukktu9.fsf@basil.nowhere.org>

On Wed, 01 Apr 2009 22:22:06 +0200
Andi Kleen <andi@firstfloor.org> wrote:

> Jeff Layton <jlayton@redhat.com> writes:
> >
> > The problem is that these checks assume that dirtied_when is updated
> > periodically. If an inode is continuously being used for I/O it can be
> > persistently marked as dirty and will continue to age. Once the time
> > difference between dirtied_when and the jiffies value it is being
> > compared to is greater than or equal to half the maximum of the jiffies
> > type, the logic of the time_*() macros inverts and the opposite of what
> > is needed is returned. On 32-bit architectures that's just under 25 days
> > (assuming HZ == 1000).
> 
> I wonder if this can happen in other places using jiffies time stamp
> too. Why not? Perhaps that check macro should be in timer.h and some auditing done
> over the whiole code base?
> 

It certainly can happen in other places. We've seen very similar
problems in NFS, and they were fixed in similar ways. That's where the
time_in_range macro came from. I agree that a thorough audit of jiffies
usage would be a fine thing...

One possibility might be a new debugging option. We could add
replacement time_after() and time_before() macros that also check
whether the difference in times is beyond a certain threshold
(maybe a day or week or so), and pop a printk or otherwise record
info about it when one is detected?

That wouldn't find all of the problem cases, but it might help ID some
of them.

-- 
Jeff Layton <jlayton@redhat.com>

  reply	other threads:[~2009-04-01 21:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-01 17:37 [PATCH] writeback: guard against jiffies wraparound on inode->dirtied_when checks (try #3) Jeff Layton
2009-04-01 20:22 ` Andi Kleen
2009-04-01 21:26   ` Jeff Layton [this message]
2009-04-01 22:12     ` Andi Kleen
2009-04-02 11:58       ` Jeff Layton

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=20090401172630.31c6ac7c@tleilax.poochiereds.net \
    --to=jlayton@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=fengguang.wu@intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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