linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Mark Fasheh <mark.fasheh@oracle.com>
Cc: Nick Piggin <npiggin@suse.de>, Hugh Dickins <hugh@veritas.com>,
	Linux Memory Management <linux-mm@kvack.org>,
	Andrew Morton <akpm@osdl.org>, Jes Sorensen <jes@sgi.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [patch 2/5] mm: fault vs invalidate/truncate race fix
Date: Tue, 10 Oct 2006 11:10:42 +1000	[thread overview]
Message-ID: <452AF312.1020207@yahoo.com.au> (raw)
In-Reply-To: <20061009211013.GP6485@ca-server1.us.oracle.com>

Mark Fasheh wrote:
> Hi Nick,
> 
> On Mon, Oct 09, 2006 at 06:12:26PM +0200, Nick Piggin wrote:
> 
>>Complexity and documentation issues aside, the locking protocol fails
>>in the case where we would like to invalidate pagecache inside i_size.
> 
> That pretty much describes part of what ocfs2_data_convert_worker() does.
> It's called when another node wants to take a lock at an incompatible level
> on an inodes data.
> 
> This involves up to two steps, depending on the level of the lock requested.
> 
> 1) It always syncs dirty data.
> 
> 2) If it's dropping due to writes on another node, then pages will be
>    invalidated and mappings torn down.

Yep, your unmap_mapping_range, and invalidate_inode_pages2 calls in there
are all subject to this bug (provided the pages being invalidated are visible
and able to be mmap()ed).

> There's actually an ocfs2 patch to support shared writeable mappings in via
> the ->page_mkwrite() callback, but I haven't pushed it upstream due to a bug
> I found during some later testing. I believe the bug is a VM issue, and your
> description of the race Andrea identified leads me to wonder if you all
> might have just found it and fixed it for me :)
> 
> 
> In short, I have an MPI test program which rotates through a set of
> processes which have mmaped a pre-formatted file. One process writes some
> data, the rest verify that they see the new data. When I run multiple
> processes on multiple nodes, I will sometimes find that one of the processes
> fails because it sees stale data.

This is roughly similar to what my test program does that I wrote to
reproduce the bug. So it wouldn't surprise me.

> FWIW, the overall approach taken in the patch below seems fine to me, though
> I'm no VM expert :)
> 
> Not having ocfs2_data_convert_worker() call unmap_mapping_range() directly,
> is ok as long as the intent of the function is preserved. You seem to be
> doing this by having truncate_inode_pages() unmap instead.

truncate_inode_pages now unmaps the pages internally, so you should
be OK there. If you're expecting this to happen frequently with mapped
pages, it is probably more efficient to call the full unmap_mapping_range
before you call truncate_inode_pages...

[ Somewhere on my todo list is a cleanup of mm/truncate.c ;) ]

If you want a stable patchset for testing, the previous one to linux-mm
starting with "[patch 1/3] mm: fault vs invalidate/truncate check" went
through some stress testing here...

-- 
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 

--
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:[~2006-10-10  1:10 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-09 16:12 [rfc] 2.6.19-rc1-git5: consolidation of file backed fault handlers Nick Piggin
2006-10-09 16:12 ` [patch 1/5] mm: fault vs invalidate/truncate check Nick Piggin
2006-10-09 16:12 ` [patch 2/5] mm: fault vs invalidate/truncate race fix Nick Piggin
2006-10-09 21:10   ` Mark Fasheh
2006-10-10  1:10     ` Nick Piggin [this message]
2006-10-11 18:34       ` Mark Fasheh
2006-10-12  3:28         ` Nick Piggin
2006-10-09 16:12 ` [patch 3/5] mm: fault handler to replace nopage and populate Nick Piggin
2006-10-09 16:12 ` [patch 4/5] mm: add vm_insert_pfn helpler Nick Piggin
2006-10-09 21:03   ` Benjamin Herrenschmidt
2006-10-10  0:42     ` Nick Piggin
2006-10-10  1:11       ` faults and signals Benjamin Herrenschmidt
2006-10-10  1:20         ` Nick Piggin
2006-10-10  1:58           ` Benjamin Herrenschmidt
2006-10-10  2:00             ` Benjamin Herrenschmidt
2006-10-10  2:04               ` Nick Piggin
2006-10-10  2:07                 ` Benjamin Herrenschmidt
2006-10-10  1:16       ` ptrace and pfn mappings Benjamin Herrenschmidt
2006-10-10  2:23         ` Nick Piggin
2006-10-10  2:47           ` Benjamin Herrenschmidt
2006-10-10  2:56             ` Benjamin Herrenschmidt
2006-10-10  3:03               ` Nick Piggin
2006-10-10  3:42                 ` Benjamin Herrenschmidt
2006-10-10  2:58             ` Nick Piggin
2006-10-10  3:40               ` Benjamin Herrenschmidt
2006-10-10  3:46                 ` Nick Piggin
2006-10-10  4:58                   ` Benjamin Herrenschmidt
2006-10-10 12:31         ` Christoph Hellwig
2006-10-10 12:42           ` Benjamin Herrenschmidt
2006-10-10 18:06           ` Hugh Dickins
2006-10-09 16:13 ` [patch 5/5] mm: merge nopfn with fault handler Nick Piggin
2006-10-09 20:57 ` [rfc] 2.6.19-rc1-git5: consolidation of file backed fault handlers Benjamin Herrenschmidt
2006-10-09 21:00   ` Benjamin Herrenschmidt
2006-10-10  0:53     ` Nick Piggin
2006-10-10 14:21 Nick Piggin
2006-10-10 14:21 ` [patch 2/5] mm: fault vs invalidate/truncate race fix Nick Piggin
2006-10-11  4:38   ` Andrew Morton
2006-10-11  5:39     ` Nick Piggin
2006-10-11  6:00       ` Andrew Morton
2006-10-11  9:21         ` Nick Piggin
2006-10-11 16:21         ` Linus Torvalds
2006-10-11 16:57           ` SPAM: " Nick Piggin
2006-10-11 17:11             ` Linus Torvalds
2006-10-11 17:21               ` SPAM: " Nick Piggin
2006-10-11 17:38                 ` Linus Torvalds
2006-10-12  3:33                   ` Nick Piggin
2006-10-12 15:37                     ` Linus Torvalds
2006-10-12 15:40                       ` Nick Piggin
2006-10-11  5:13   ` Andrew Morton
2006-10-11  5:50     ` Nick Piggin
2006-10-11  6:10       ` Andrew Morton
2006-10-21  1:53       ` Benjamin Herrenschmidt

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=452AF312.1020207@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=akpm@osdl.org \
    --cc=benh@kernel.crashing.org \
    --cc=hugh@veritas.com \
    --cc=jes@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mark.fasheh@oracle.com \
    --cc=mingo@elte.hu \
    --cc=npiggin@suse.de \
    /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