linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Sage Weil <sage@newdream.net>
Cc: npiggin@suse.de, trond.myklebust@fys.uio.no,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [patch] mm: close page_mkwrite races
Date: Wed, 1 Apr 2009 16:02:41 -0700	[thread overview]
Message-ID: <20090401160241.ec2f4573.akpm@linux-foundation.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0903311244200.19769@cobra.newdream.net>

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?

> > 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.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2009-04-01 23:02 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 [this message]
2009-04-01 23:33       ` Trond Myklebust
2009-04-02  9:00         ` Nick Piggin
2009-04-02  9:04       ` Nick Piggin

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=20090401160241.ec2f4573.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=npiggin@suse.de \
    --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).