From: Nick Piggin <nickpiggin@yahoo.com.au>
To: David Howells <dhowells@redhat.com>
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: Thu, 17 May 2007 16:39:46 +1000 [thread overview]
Message-ID: <464BF8B2.3080101@yahoo.com.au> (raw)
In-Reply-To: <31162.1179341123@redhat.com>
David Howells wrote:
> Nick Piggin <nickpiggin@yahoo.com.au> wrote:
>
>
>>You can drop the lock, do the invalidation,
>
>
> Hmmm... There's a danger of incurring a race by doing that. Consider two
> processes both trying to write to a dirty page for which writeback will be
> rejected:
>
> (1) The first process gets EKEYREJECTED from the server, drops its lock and
> is then preempted.
>
> (2) The second process gets EKEYREJECTED from the server, drops its lock,
> truncates the page, reloads the page and modifies it.
>
> (3) The first process resumes and truncates the page, thereby splatting the
> second process's write.
>
> Or:
>
> (1) The first process gets EKEYREJECTED from the server, clears the writeback
> information from the page, drops its lock and is then preempted.
>
> (2) The second process attaches its own writeback information to the page and
> modifies it.
>
> (3) The first process resumes and truncates the page, thereby splatting the
> second process's write.
If there are race issues involving concurrent invalidations, then you'd
fix that up by taking a filesystem specific lock to prevent them.
Generic write path should be holding i_mutex, but I don't think you can
take that from page_mkwrite... Just add one of your own.
> Really, what I want to do is pass the page lock to truncate to deal with.
> Better still, I want truncate to be selective, based on whether or not a page
> is still associated with the rejected writeback. I wonder if I should call
> truncate_complete_page() or invalidate_complete_page() directly.
No, you shouldn't. We could theoretically introduce a new API for this,
but I think it would be preferable if you can fix the race in the fs.
--
SUSE Labs, Novell Inc.
next prev parent reply other threads:[~2007-05-17 6:39 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
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 [this message]
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=464BF8B2.3080101@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@osdl.org \
--cc=dhowells@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox