mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Tweedie <sct@redhat.com>
To: Marcelo Tosatti <marcelo@conectiva.com.br>, linux-kernel@vger.kernel.org
Cc: Stephen Tweedie <sct@redhat.com>
Subject: [Patch 3/8] 2.4.20-pre4/ext3: Fix the "dump corrupts filesystems" buffer-cache bug.
Date: Wed, 28 Aug 2002 16:45:19 +0100	[thread overview]
Message-ID: <200208281545.g7SFjJJ14330@sisko.scot.redhat.com> (raw)

Since block-dev-in-page-cache was added in 2.4.10, and the aliasing between
buffered devices and getblk() was restored in 2.4.11, getblk() and friends
can be performing IO on a page cache page without the page cache lock
being held.  The page cache IO assumes that the page cache lock is enough
to synchronise things safely, but this breaks if we get aliased IO.

In particular, block_read_full_page() assumes that it is safe to begin IO
on any non-uptodate bh, regardless of the locked status of the bh.  To be
safe, we need to test the uptodate state *after* taking the bh lock.

Already in 2.5.

--- linux-ext3-2.4merge/fs/buffer.c.=K0004=.orig	Tue Aug 27 23:14:15 2002
+++ linux-ext3-2.4merge/fs/buffer.c	Tue Aug 27 23:19:57 2002
@@ -1748,9 +1748,14 @@
 	}
 
 	/* Stage 3: start the IO */
-	for (i = 0; i < nr; i++)
-		submit_bh(READ, arr[i]);
-
+	for (i = 0; i < nr; i++) {
+		struct buffer_head * bh = arr[i];
+		if (buffer_uptodate(bh))
+			end_buffer_io_async(bh, 1);
+		else
+			submit_bh(READ, bh);
+	}
+	
 	return 0;
 }
 

                 reply	other threads:[~2002-08-28 15:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200208281545.g7SFjJJ14330@sisko.scot.redhat.com \
    --to=sct@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    /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

all inboxes | Powered by JetHome®