All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Hugh Dickins <hugh@veritas.com>
Cc: Andrea Arcangeli <andrea@suse.de>, Andrew Morton <akpm@osdl.org>,
	David Howells <dhowells@redhat.com>,
	Linux Memory Management <linux-mm@kvack.org>
Subject: Re: [patch][rfc] possible lock_page fix for Andrea's nopage vs invalidate race?
Date: Tue, 08 Aug 2006 11:14:44 +1000	[thread overview]
Message-ID: <44D7E584.10109@yahoo.com.au> (raw)
In-Reply-To: <Pine.LNX.4.64.0608071752040.20812@blonde.wat.veritas.com>

Hugh Dickins wrote:
> On Tue, 8 Aug 2006, Nick Piggin wrote:
> 
>>Hugh Dickins wrote:
>>
>>>Hmmm, page_mkwrite when called from do_wp_page would not expect to
>>>be holding page lock: we don't want it called with in one case and
>>>without in the other.  Maybe do_no_page needs to unlock_page before
>>>calling page_mkwrite, lock_page after, and check page->mapping when
>>>VM_NOPAGE_LOCKED??
>>
>>That's pretty foul. I'll take a bit of a look. Is it really a problem
>>to call in either state, if it is well documented? (we could even
>>send a flag down if needed). I thought filesystem code loved this
>>kind of spaghetti locking?
> 
> 
> Agreed foul.  David's helpful mail reassures not an immediate problem,
> but I'm pretty sure other future uses of page_mkwrite would need to
> know if the page is held locked or not.  Yes, could be done by a flag,
> though that's not pretty (gives the ->page_mkwrite implementation much
> the same schizophrenia as I was disliking here in do_no_page).

But it would be better to do it in the theoretical page_mkwrite that
cares, maybe? Imagine one that did want to have the page locked.

Well I'll leave this issue alone for the next iteration.

> 
> 
>>I don't think ->populate has ever particularly troubled itself with
>>these kinds of theoretical races. I was really hoping to fix linear
>>pagecache first before getting bogged down with nonlinear.
> 
> 
> install_page has had mapping & i_size check for quite a while, but
> perhaps by theoretical races you mean Andrea's invalidate case.
> The nonlinear case is much less a concern than MAP_POPULATE
> (though I don't know if anyone really uses that).

Sure but it doesn't do any truncate_count checking. So nothing in my
patch will make it worse than it already is.

> 
> 
>>After thinking about it a bit more, I think I've found my filemap_nopage
>>wanting. Suppose i_size is shrunk and the page truncated before the
>>first find_lock_page. OK, no we'll allocate a new page, add it to the
>>pagecache, and do a ->readpage().
> 
> 
> I've got a bit lost between merges against different trees,
> I'll let you sort that one out.

I wonder if we should have the i_size check (under the page lock) in
do_no_page or down in the ->nopage implementations?

-- 
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-08-08  1:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-01 11:36 [patch][rfc] possible lock_page fix for Andrea's nopage vs invalidate race? Nick Piggin
2006-08-01 14:27 ` Andrea Arcangeli
2006-08-02  0:19   ` Nick Piggin
2006-08-03 16:04 ` Hugh Dickins
2006-08-03 16:34   ` David Howells
2006-08-05  3:52   ` Nick Piggin
2006-08-07 14:18   ` Nick Piggin
2006-08-07 14:58     ` Nick Piggin
2006-08-07 15:25       ` Hugh Dickins
2006-08-08  1:17         ` Nick Piggin
2006-08-07 17:05     ` Hugh Dickins
2006-08-08  1:14       ` Nick Piggin [this message]
2006-08-08 18:19         ` Hugh Dickins

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=44D7E584.10109@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=akpm@osdl.org \
    --cc=andrea@suse.de \
    --cc=dhowells@redhat.com \
    --cc=hugh@veritas.com \
    --cc=linux-mm@kvack.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.