The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Chris Mason <mason@suse.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: deadlocks caused by ext3/reiser dirty_inode calls during do_mmap_pgoff
Date: Tue, 22 Jun 2004 12:05:40 -0700	[thread overview]
Message-ID: <20040622120540.1bc8b6e3.akpm@osdl.org> (raw)
In-Reply-To: <1087915399.1512.267.camel@watt.suse.com>

Chris Mason <mason@suse.com> wrote:
>
> On Mon, 2004-06-21 at 20:13, Andrew Morton wrote:
> 
> > It's super-improbable because we fault the source page in by hand in
> > generic_file_aio_write_nolock() via fault_in_pages_readable().  Of course,
> > that prefaulting isn't 100% reliable either, because the VM can come in and
> > steal the page (or at least unmap its pte) before we get to doing the copy.
> > 
> > I think we can fix both problems by changing filemap_copy_from_user() and
> > filemap_copy_from_user_iovec() to not fall back to kmap() - just fail the
> > copy in some way if the atomic copy failed.  Then, in
> > generic_file_aio_write_nolock(), do a zero-length ->commit_write(),
> > put_page(), then go back and retry the whole thing, starting with
> > fault_in_pages_readable().
> 
> Oh, just realized this will break our data=ordered setup.  prepare_write
> is going to do things like allocating blocks in the file etc etc.  If we
> close the transaction via commit_write(0 size) and crash, we'll leak.

OK, then just zero the pagecache page between `from' and `to' and call
->commit_write() with unmodified `from' and `to'?

> We might need to do prefault + pin on the user pages.

That's always been the correct way to fix these problems, but it involves a
pagetable walk, which requires page_table_lock.  Not a popular thing to be
doing on the write() fastpath.

  reply	other threads:[~2004-06-22 19:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-21 16:59 deadlocks caused by ext3/reiser dirty_inode calls during do_mmap_pgoff Chris Mason
2004-06-22  0:13 ` Andrew Morton
2004-06-22 14:13   ` Chris Mason
2004-06-22 18:57     ` Andrew Morton
2004-06-22 20:32       ` Chris Mason
2004-06-22 14:43   ` Chris Mason
2004-06-22 19:05     ` Andrew Morton [this message]
2004-06-22 20:41       ` Chris Mason
2004-06-25 17:59       ` Chris Mason

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=20040622120540.1bc8b6e3.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mason@suse.com \
    /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