linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@suse.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Sage Weil <sage@newdream.net>,
	trond.myklebust@fys.uio.no, linux-fsdevel@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [patch] mm: close page_mkwrite races
Date: Thu, 2 Apr 2009 11:04:21 +0200	[thread overview]
Message-ID: <20090402090421.GB22256@wotan.suse.de> (raw)
In-Reply-To: <20090401160241.ec2f4573.akpm@linux-foundation.org>

On Wed, Apr 01, 2009 at 04:02:41PM -0700, Andrew Morton wrote:
> On Tue, 31 Mar 2009 12:55:16 -0700 (PDT)
> Sage Weil <sage@newdream.net> wrote:
> 
> > On Mon, 30 Mar 2009, Nick Piggin wrote:
> > > [Fixed linux-mm address. Please reply here]
> > > 
> > > Hi,
> > > 
> > > I'd like opinions on this patch (applies on top of the previous
> > > page_mkwrite fixes in -mm). I was not going to ask to merge it
> > > immediately however it appears that fsblock is not the only one who
> > > needs it...
> > > --
> > > 
> > > I want to have the page be protected by page lock between page_mkwrite
> > > notification to the filesystem, and the actual setting of the page
> > > dirty. Do this by allowing the filesystem to return a locked page from
> > > page_mkwrite, and have the page fault code keep it held until after it
> > > calls set_page_dirty.
> > > 
> > > I need this in fsblock because I am working to ensure filesystem metadata
> > > can be correctly allocated and refcounted. This means that page cleaning
> > > should not require memory allocation.
> 
> wot?  "page cleaning" involves writeout.  How can we avoid doing
> allocations there?

Oh, guaranteed allocations like from mempools are fine of course.
But yeah the changelog is slightly more fsblock oriented than it
probably needs to be... I didn't really edit it after taking out
of my series.


> > > Without this patch, then for example we could get a concurrent writeout
> > > after the page_mkwrite (which allocates page metadata required to clean
> > > it), but before the set_page_dirty. The writeout will clean the page and
> > > notice that the metadata is now unused and may be deallocated (because
> > > it appears clean as set_page_dirty hasn't been called yet). So at this
> > > point the page may be dirtied via the pte without enough metadata to be
> > > able to write it back.
> > > 
> > > Sage needs this race closed for ceph, and Trond maybe for NFS.
> > 
> > I ran a few tests and this fixes the problem for me (although fyi the 
> > patch didn't apply cleanly on top of your previously posted page_mkwrite 
> > prototype change patch, due to some differences in block_page_mkwrite).
> 
> What is "the problem"?  Can we get "the problem"'s description included
> in the changelog?
> 
> The patch is fairly ugly, somewhat costly and makes things (even) more
> complex.    Sigh.

I guess it is another step toward being able to pull page_mkwrite into
->fault which will avoid one lock/unlock cycle and lots of stuff in
the main fault path.
 
Also fixes bug of course.



      parent reply	other threads:[~2009-04-02  9:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-30 13:53 [patch] mm: close page_mkwrite races Nick Piggin
2009-03-30 13:56 ` Nick Piggin
2009-03-31 19:55   ` Sage Weil
2009-04-01 23:02     ` Andrew Morton
2009-04-01 23:33       ` Trond Myklebust
2009-04-02  9:00         ` Nick Piggin
2009-04-02  9:04       ` Nick Piggin [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=20090402090421.GB22256@wotan.suse.de \
    --to=npiggin@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sage@newdream.net \
    --cc=trond.myklebust@fys.uio.no \
    /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).