From: David Howells <dhowells@redhat.com>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] AFS: Implement shared-writable mmap [try #2]
Date: Wed, 16 May 2007 17:12:08 +0100 [thread overview]
Message-ID: <19714.1179331928@redhat.com> (raw)
In-Reply-To: <464B07EC.4050308@yahoo.com.au>
Nick Piggin <nickpiggin@yahoo.com.au> wrote:
> In general (modulo bugs and crazy filesystems), you're not allowed to have
> !uptodate pages mapped into user addresses because that implies the user
> would be allowed to see garbage.
Ths situation I have to deal with is a tricky one. Consider:
(1) User A modifies a page with his key. This change gets made in the
pagecache, but is not written back immediately.
(2) User B then wants to modify the same page, but with a different key.
This means that afs_prepare_write() has to flush A's writes back to the
server before B is permitted to write.
(3) The flush fails because A is no longer permitted to write to that file.
This means that the change in the page cache is now stale. We can't just
write it back as B because B didn't make the change.
What I've made afs_prepare_write() do in this situation is to nuke A's entire
write. We can't write any of it back. I can't call invalidate_inode_pages()
or similar because that might incorrectly kill one of B's writes (or someone
else's writes); besides, the on-server file hasn't changed.
To nuke A's write, each page that makes up that write is marked non-uptodate
and then reloaded. Whilst I might wish to call invalidate_inode_pages_range(),
I can't as it can/would deadlock if called from prepare_write() in two
different ways.
> >>Minor issue: you can just check for `if (!page->mapping)` for truncation,
> >>which is the usual signal to tell the reader you're checking for truncate.
> >
> >
> > That's inconsistent with other core code, truncate_complete_page() for
> > example.
>
> Your filesystem internally moves pages between mappings like tmpfs?
You misunderstand me. truncate_complete_page() uses this:
if (page->mapping != mapping)
not this:
if (!page->mapping)
I think that both cases should work in page_mkwrite(). But !page->mapping does
not appear to be the "usual signal" from what I've seen.
However, that's a minor matter.
David
next prev parent reply other threads:[~2007-05-16 16:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-16 10:02 [PATCH] AFS: Implement shared-writable mmap [try #2] David Howells
2007-05-16 12:07 ` Nick Piggin
2007-05-16 13:16 ` David Howells
2007-05-16 13:32 ` Nick Piggin
2007-05-16 16:12 ` David Howells [this message]
2007-05-16 16:32 ` Nick Piggin
2007-05-16 16:56 ` David Howells
2007-05-16 17:28 ` Nick Piggin
2007-05-16 17:46 ` David Howells
2007-05-16 17:59 ` Nick Piggin
2007-05-16 18:45 ` David Howells
2007-05-17 6:39 ` Nick Piggin
2007-05-17 12:30 ` David Howells
2007-05-17 17:46 ` David Howells
2007-05-18 2:29 ` 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=19714.1179331928@redhat.com \
--to=dhowells@redhat.com \
--cc=akpm@osdl.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox