linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Daniel Phillips <phillips@arcor.de>
Cc: David Howells <dhowells@redhat.com>,
	Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	hugh@veritas.com
Subject: Re: [RFC][patch 0/2] mm: remove PageReserved
Date: Tue, 16 Aug 2005 11:28:08 +0100	[thread overview]
Message-ID: <16339.1124188088@warthog.cambridge.redhat.com> (raw)
In-Reply-To: <200508161153.59476.phillips@arcor.de>

Daniel Phillips <phillips@arcor.de> wrote:

> > I want to know when a page is going to be modified so that I
> > can predict the state of the cache as much as possible. I don't want
> > userspace processes corrupting the cache in unrecorded ways.
> 
> There are two cases:
> 
>   1) Metadata.  If anybody is doing racy writes to metadata pages, it is
>      your filesystem, and you have a bug.

I didn't say that I had a problem with metadata. I don't (or shouldn't). I
have done my best to implement filesystem integrity on CacheFS. CacheFiles is
harder to do this for because I have to work through another filesystem to
maintain consistency.

>   2) Data.  In Linux practice and Posix, racy writes to files have
>      undefined semantics, including the possibility that data may end up
>      interleaved on a disk block.

There are more cases than you are considering. This point can be split into
writing into the cache from a read from the netfs and writing into the cache
from a write to the netfs.

Don't forget that the cache isn't the data backing store (eg: NFS).

> You seem to be trying to define (2) as "corruption" and setting out to
> prevent it.  But it is not the responsibility of a filesystem to prevent
> this, it is the responsibility of the application.
> 
> Could you please explain why it is not ok to end up with a half-written page 
> in your cache, if the client was in fact halfway through writing it when it 
> crashed?

Because then the cache may hold something other than what the server displays,
and once the client computer is back on its feet after a crash it will then
read bad data from the cache.

Of course, the netfs can make the effort to write the half-written data back
to the server upon recovery, _if_ it can work out which that is, and _if_ the
server's idea of the current state hasn't advanced whilst the client was out
of commission (see AFS).

Basically, you've got four choices:

 (1) Prevention.

 (2) Cache invalidation.

 (3) Cache flush.

 (4) Pretend nothing happened.

I really hate the idea of (4) - we can end up with the cache and the server
having two totally different ideas on what the data ought to be because we
couldn't be bothered to fix it up. (3) is tricky as we have to work out what
is different. (2) is easiest - it _is_ a cache after all - but we don't want
to invalidate the _entire_ cache. (1) is relatively cheap in CacheFS.

With FS-Cache as I have implemented it, this is a choice made entirely by the
netfs. All FS-Cache/CacheFS does is wait to be given a page to write and then
tell you when it's written it, and allow you to arbitrarily mark inodes in
their auxilliary data. But that's it. Full stop. The netfs interface is
extremely simple - about as simple as I can make it (it has been revised
recently with this in mind).

Also, it could copy the data before writing, but that has two problems:

 (1) You have to have a page to copy the data into.

 (2) You have to copy the page.


Maintaining cache coherency really isn't fun. You've got a server with a bunch
of totally separate clients that may or may not know about one another and
each of these has a page cache and a local disk cache and a dcache.

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>

  parent reply	other threads:[~2005-08-16 10:28 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-07  3:28 Nick Piggin
2005-08-07  3:29 ` [patch 1/2] mm: remap ZERO_PAGE mappings Nick Piggin
2005-08-07  3:30   ` [patch 2/2] mm: core remove PageReserved Nick Piggin
2005-08-08 21:09 ` [RFC][patch 0/2] mm: " Daniel Phillips
2005-08-08 21:24   ` Daniel Phillips
2005-08-08 21:54     ` Andrew Morton
2005-08-09 23:23       ` [RFC][PATCH] Rename PageChecked as PageMiscFS Daniel Phillips
2005-08-10  7:48         ` Hugh Dickins
2005-08-10  8:06           ` Daniel Phillips
2005-08-10 22:12       ` Daniel Phillips
2005-08-10 22:23         ` Daniel Phillips
2005-08-10 22:34           ` Trond Myklebust
2005-08-10 22:57             ` Daniel Phillips
2005-08-10 23:23               ` Trond Myklebust
2005-08-11  9:42               ` David Howells
2005-08-10 23:42           ` Adrian Bunk
2005-08-11  9:46           ` David Howells
2005-08-12  2:34             ` Daniel Phillips
2005-08-12 12:32             ` David Howells
2005-08-11  9:31         ` David Howells
2005-08-11  9:26       ` David Howells
2005-08-12  3:29         ` Daniel Phillips
2005-08-12 12:41         ` David Howells
2005-08-12 13:28           ` Hugh Dickins
2005-08-16 13:59           ` Pavel Machek
2005-08-18 14:33           ` David Howells
2005-08-18 22:27             ` Pavel Machek
2005-08-19 10:04             ` David Howells
2005-08-19 16:31               ` Daniel Phillips
2005-08-20 10:45               ` David Howells
2005-08-20 20:21                 ` Daniel Phillips
2005-08-10 13:13     ` [RFC][patch 0/2] mm: remove PageReserved David Howells
2005-08-10 13:34       ` Daniel Phillips
2005-08-10 14:27       ` David Howells
2005-08-10 23:19         ` Daniel Phillips
2005-08-11 10:49         ` David Howells
2005-08-12 19:34           ` Daniel Phillips
2005-08-15 13:15           ` David Howells
2005-08-16  1:53             ` Daniel Phillips
2005-08-16 10:28             ` David Howells [this message]
2005-08-09  0:15   ` Nick Piggin
2005-08-09  8:51     ` Benjamin Herrenschmidt
2005-08-09  9:49       ` Nick Piggin
2005-08-09 19:19         ` Daniel Phillips
2005-08-09 19:22         ` Daniel Phillips
2005-08-10 21:50           ` Pavel Machek
2005-08-10 21:56             ` Martin J. Bligh
2005-08-11 10:36               ` Rafael J. Wysocki
2005-08-12 19:56                 ` Daniel Phillips
2005-08-12 22:20                   ` Rafael J. Wysocki
2005-08-12 23:04                     ` Daniel Phillips
2005-08-13  7:06                       ` Rafael J. Wysocki
2005-08-11 10:26             ` Rafael J. Wysocki
2005-08-09 11:25       ` Hugh Dickins
2005-08-09 14:31         ` Benjamin Herrenschmidt
2005-08-09 14:50           ` Hugh Dickins
2005-08-09 14:49             ` Benjamin Herrenschmidt
2005-08-09 15:36               ` Hugh Dickins
2005-08-09 21:27                 ` Daniel Phillips
2005-08-09 19:14     ` Daniel Phillips
2005-08-09 20:17       ` Hugh Dickins
2005-08-09 20:52         ` Daniel Phillips
2005-08-09  4:39   ` Nigel Cunningham
2005-08-09  4:59     ` Nick Piggin
2005-08-09  5:11       ` Nigel Cunningham
2005-08-09  5:20         ` Nick Piggin
2005-08-09  5:30           ` Nigel Cunningham
2005-08-09  7:08       ` Russell King
2005-08-09  8:38         ` Arjan van de Ven
2005-08-09  9:31           ` Nick Piggin
2005-08-09  9:49             ` Arjan van de Ven
2005-08-09  9:57               ` Nick Piggin
2005-08-09 10:24             ` Rafael J. Wysocki
2005-08-09  8:53         ` Benjamin Herrenschmidt
2005-08-09  9:15         ` Hugh Dickins
2005-08-09 10:27           ` Nick Piggin
2005-08-09 11:15             ` Hugh Dickins
2005-08-09 13:15               ` Nick Piggin
2005-08-09 13:26                 ` Arjan van de Ven
2005-08-09 14:28               ` Benjamin Herrenschmidt
2005-08-09 14:47                 ` Hugh Dickins
2005-08-09 19:49           ` Roman Zippel
2005-08-09  9:29         ` Nick Piggin
2005-08-09 19:40           ` Russell King
2005-08-09 14:38         ` Martin J. Bligh
2005-08-09 19:41           ` Russell King
2005-08-09 20:51             ` Linus Torvalds
2005-08-09 21:16             ` Martin J. Bligh
2005-08-09 21:51               ` Martin J. Bligh
2005-08-10  9:27             ` Benjamin Herrenschmidt
2005-08-11  9:09               ` 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=16339.1124188088@warthog.cambridge.redhat.com \
    --to=dhowells@redhat.com \
    --cc=akpm@osdl.org \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=phillips@arcor.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