The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@zip.com.au>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Scalable page cache
Date: Mon, 26 Nov 2001 13:02:42 -0800	[thread overview]
Message-ID: <3C02ADF2.E505E672@zip.com.au> (raw)
In-Reply-To: <3C02A00B.B9948342@zip.com.au>, <3C029BE0.2BEA2264@zip.com.au>, <Pine.LNX.4.33.0111262201420.18923-100000@localhost.localdomain> <20011126.111854.102567147.davem@redhat.com> <3C029BE0.2BEA2264@zip.com.au> <20011126.115723.41632923.davem@redhat.com> <200111262037.fAQKblt10496@penguin.transmeta.com>

Linus Torvalds wrote:
> 
> In article <3C02A00B.B9948342@zip.com.au> you write:
> >
> >Here's the current rolled-up ext3 diff which I've been using.
> >It needs to be resynced with pestiferous ext3 CVS, changelogged
> >and pushed out this week.
> >
> >--- linux-2.4.15-pre9/fs/ext3/inode.c  Thu Nov 22 10:56:33 2001
> >+++ linux-akpm/fs/ext3/inode.c Thu Nov 22 11:07:03 2001
> >@@ -1026,9 +1026,20 @@ static int ext3_prepare_write(struct fil
> >       if (ret != 0)
> >               goto prepare_write_failed;
> >
> >-      if (ext3_should_journal_data(inode))
> >+      if (ext3_should_journal_data(inode)) {
> >               ret = walk_page_buffers(handle, page->buffers,
> >                               from, to, NULL, do_journal_get_write_access);
> >+              if (ret) {
> >+                      /*
> >+                       * We're going to fail this prepare_write(),
> >+                       * so commit_write() will not be called.
> >+                       * We need to undo block_prepare_write()'s kmap().
> >+                       * AKPM: Do we need to clear PageUptodate?  I don't
> >+                       * think so.
> >+                       */
> >+                      kunmap(page);
> >+              }
> >+      }
> 
> This is wrong.
> 
> The generic VM layer does the kmap/kunmap itself these days (it really
> always should have - it needs the page mapped itself for the memcpy
> anyway, and depending on the low-level FS to do kmap/kunmap was an ugly
> layering violation).

Actually the comment is a bit misleading.

We've called block_prepare_write(), which has done the kmap.
But even though block_prepare_write() returned success, this
call to the filesystem's ->prepare_write() is about to fail.

So the caller of ->prepare_write() isn't going to run ->commit_write(),
and we have to undo the kmap here.

> So you should just remove all the kmap/kunmap stuff in
> prepare/commit_write instead of adding more of them to handle the
> brokenness.

There have been a number of mistakes made over this particular kmap()
operation.  NFS client had it wrong for a while. I think sct had
some proposal for making it more robust.

-

  reply	other threads:[~2001-11-26 21:05 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-26 12:31 [PATCH] Scalable page cache Momchil Velikov
2001-11-26 17:22 ` Ingo Molnar
2001-11-26 17:23   ` Momchil Velikov
2001-11-26 18:16     ` Benjamin LaHaise
2001-11-26 18:42       ` Rik van Riel
2001-11-26 20:29       ` Ingo Molnar
2001-11-26 18:33         ` David S. Miller
2001-11-26 19:29           ` Andrew Morton
2001-11-26 19:35             ` David S. Miller
2001-11-26 18:34         ` Benjamin LaHaise
2001-11-26 20:40       ` Ingo Molnar
2001-11-26 19:19         ` Benjamin LaHaise
2001-11-26 21:00         ` Ingo Molnar
2001-11-26 20:43       ` Daniel Phillips
2001-11-26 19:49     ` Ingo Molnar
2001-11-26 18:08       ` Christoph Hellwig
2001-11-26 20:13         ` Ingo Molnar
2001-11-26 21:09     ` Ingo Molnar
2001-11-26 19:18       ` David S. Miller
2001-11-26 19:45         ` Andrew Morton
2001-11-26 19:57           ` David S. Miller
2001-11-26 20:03             ` Andrew Morton
2001-11-26 20:37             ` Linus Torvalds
2001-11-26 21:02               ` Andrew Morton [this message]
2001-11-26 22:23                 ` Linus Torvalds
2001-11-26 22:49                   ` Jeff Garzik
2001-11-26 23:06                     ` Linus Torvalds
2001-11-26 21:10       ` Ingo Molnar
2001-11-26 17:29   ` Linus Torvalds
2001-11-26 20:03     ` Ingo Molnar
2001-11-26 18:02   ` David S. Miller
2001-11-26 18:11     ` Rik van Riel
2001-11-27  8:07     ` benchmark results: " Anton Blanchard
2001-11-26 18:52   ` [PATCH] " Daniel Phillips

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=3C02ADF2.E505E672@zip.com.au \
    --to=akpm@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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