From: David Howells <dhowells@redhat.com>
To: Hugh Dickins <hugh@veritas.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>,
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: Thu, 03 Aug 2006 17:34:54 +0100 [thread overview]
Message-ID: <11315.1154622894@warthog.cambridge.redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0608031526400.15351@blonde.wat.veritas.com>
Hugh Dickins <hugh@veritas.com> wrote:
> >
> > /*
> > * Should we do an early C-O-W break?
>
> Somewhere below here you're missing a hunk to deal with a failed
> page_mkwrite, needing to unlock_page(locked_page). We don't have
> an example of a page_mkwrite in tree at present, but it seems
> reasonable to suppose that we not it should unlock the page.
>
> Hmm, David Howells has an afs_file_page_mkwrite which sits waiting
> for an FsMisc page flag to be cleared: might that deadlock with the
> page lock held? If so, it may need to unlock and relock the page,
> rechecking for truncation.
>
> 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??
For what I'm using page_mkwrite() and PG_fs_misc for, there shouldn't be a
deadlock:
(1) PG_fs_misc has to be set whilst we are holding the page lock after
reading the page, since the VM could race with page release otherwise.
(2) If the cache refuses to store the page, PG_fs_misc is cleared immediately
before the page lock is released.
(3) If the cache agrees to store the page, it will start the process of
storing the page to disk, and doesn't require the page to remain locked.
When the I/O is complete, the cache will call back into the netfs (AFS or
NFS, for example) and the netfs will clear PG_fs_misc and wake up anyone
waiting for it. It will not attempt to lock the page.
(4) If page_mkwrite() is called, it will simply call wait_on_page_fs_misc(),
and will not attempt to lock the page.
I don't think the caller of page_mkwrite() ever has the page locked
currently. It's possible someone else has the page locked, and that
page_mkwrite() might have to wait for it to become unlocked, depending on what
it wants to do.
But for the page being locked during reading, do_no_page() makes sure the page
is unlocked before page_mkwrite() can be called.
David
--
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>
next prev parent reply other threads:[~2006-08-03 16:34 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 [this message]
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
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=11315.1154622894@warthog.cambridge.redhat.com \
--to=dhowells@redhat.com \
--cc=akpm@osdl.org \
--cc=andrea@suse.de \
--cc=hugh@veritas.com \
--cc=linux-mm@kvack.org \
--cc=nickpiggin@yahoo.com.au \
/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.