linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Niehusmann <jan@gondor.com>
To: linux-kernel@vger.kernel.org, adilger@turbolinux.com
Cc: "Udo A. Steinberg" <sorisor@Hell.WH8.TU-Dresden.De>,
	Byron Stanoszek <gandalf@winds.org>
Subject: [PATCH] Re: fs corruption with invalidate_buffers()
Date: Thu, 7 Dec 2000 22:30:43 +0100	[thread overview]
Message-ID: <20001207223043.A994@gondor.com> (raw)
In-Reply-To: <20001206030723.A1136@gondor.com> <20001207200558.A976@gondor.com>
In-Reply-To: <20001207200558.A976@gondor.com>; from jan@gondor.com on Thu, Dec 07, 2000 at 08:05:58PM +0100

The following patch actually prevents the corruption I described.

I'd like to hear from the people having problems with hdparm, if it helps
them, too.

Please note that the patch circumvents the problem more than it fixes it.
The true fix would invalidate the mappings, but I don't know how to do it.

Jan

--- linux-2.4.0-test11/fs/buffer.c	Mon Nov 20 08:55:05 2000
+++ test/fs/buffer.c	Thu Dec  7 22:28:24 2000
@@ -589,7 +589,7 @@
    then an invalidate_buffers call that doesn't trash dirty buffers. */
 void __invalidate_buffers(kdev_t dev, int destroy_dirty_buffers)
 {
-	int i, nlist, slept;
+	int i, nlist, slept, db_message=0;
 	struct buffer_head * bh, * bh_next;
 
  retry:
@@ -615,8 +615,13 @@
 			write_lock(&hash_table_lock);
 			if (!atomic_read(&bh->b_count) &&
 			    (destroy_dirty_buffers || !buffer_dirty(bh))) {
-				__remove_from_queues(bh);
-				put_last_free(bh);
+				if(bh->b_page 
+					&& bh->b_page->mapping) { 
+					db_message=1;
+				} else { 
+					__remove_from_queues(bh);
+					put_last_free(bh);
+				}
 			}
 			/* else complain loudly? */
 
@@ -629,6 +634,8 @@
 	spin_unlock(&lru_list_lock);
 	if (slept)
 		goto retry;
+	if(db_message)
+		printk("invalidate_buffer with mapped page\n");
 }
 
 void set_blocksize(kdev_t dev, int size)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  reply	other threads:[~2000-12-07 22:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-06  2:07 fs corruption with invalidate_buffers() Jan Niehusmann
2000-12-07 19:05 ` Jan Niehusmann
2000-12-07 21:30   ` Jan Niehusmann [this message]
2000-12-07 22:03     ` [PATCH] " Udo A. Steinberg
2000-12-07 22:26       ` Alexander Viro
2000-12-07 23:37         ` Jan Niehusmann
2000-12-22  0:03         ` Jan Niehusmann
2000-12-22  0:37           ` Linus Torvalds
2000-12-22  0:48             ` Jan Niehusmann
2000-12-22  1:01               ` Linus Torvalds
2000-12-22  1:49                 ` Jan Niehusmann
2000-12-22  1:56             ` Alexander Viro

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=20001207223043.A994@gondor.com \
    --to=jan@gondor.com \
    --cc=adilger@turbolinux.com \
    --cc=gandalf@winds.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sorisor@Hell.WH8.TU-Dresden.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;
as well as URLs for NNTP newsgroup(s).