All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Niehusmann <jan@gondor.com>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Alexander Viro <viro@math.psu.edu>,
	linux-kernel@vger.kernel.org, adilger@turbolinux.com
Subject: Re: [PATCH] Re: fs corruption with invalidate_buffers()
Date: Fri, 22 Dec 2000 02:49:33 +0100	[thread overview]
Message-ID: <20001222024933.A979@gondor.com> (raw)
In-Reply-To: <20001222014810.A1419@gondor.com> <Pine.LNX.4.10.10012211659390.15507-100000@penguin.transmeta.com>
In-Reply-To: <Pine.LNX.4.10.10012211659390.15507-100000@penguin.transmeta.com>; from torvalds@transmeta.com on Thu, Dec 21, 2000 at 05:01:00PM -0800

On Thu, Dec 21, 2000 at 05:01:00PM -0800, Linus Torvalds wrote:
> 
> 
> On Fri, 22 Dec 2000, Jan Niehusmann wrote:
> > 
> > The test I did initially was the following:
> > 
> > if(!atomic_read(&bh->b_count) &&
> > 	(destroy_dirty_buffers || !buffer_dirty(bh))
> > 	&& ! (bh->b_page && bh->b_page->mapping)
> > 	)
> > 
> > That is, I was explicitely checking for a mapped page. It worked well, too.
> > Is this more reasonable?
> 
> I'd suggest just doing this instead (warning: cut-and-paste in xterm, so
> white-space damage):

> which just ignores mapped buffers entirely (and doesn't test for
> bh->b_page being non-NULL, because that shouldn't be allowed anyway).

Yes, looks good to me, and passes some tests. Here is a patch that has not
been cut and pasted:

--- linux/fs/buffer.c.orig	Thu Dec 21 20:30:03 2000
+++ linux/fs/buffer.c	Fri Dec 22 02:11:29 2000
@@ -643,7 +643,12 @@
 			continue;
 		for (i = nr_buffers_type[nlist]; i > 0 ; bh = bh_next, i--) {
 			bh_next = bh->b_next_free;
+
+			/* Another device? */
 			if (bh->b_dev != dev)
+				continue;
+			/* Part of a mapping? */
+			if (bh->b_page->mapping)
 				continue;
 			if (buffer_locked(bh)) {
 				atomic_inc(&bh->b_count);


I have one additional question: invalidate_buffers normally gets called if
someone wants to make sure that, after the call, read accesses to a device
really go to the device and don't get served by a cache. Is there some
mechanismn that does the same thing to mapped pages? 

Jan


-
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-22  2:25 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   ` [PATCH] " Jan Niehusmann
2000-12-07 22:03     ` 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 [this message]
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=20001222024933.A979@gondor.com \
    --to=jan@gondor.com \
    --cc=adilger@turbolinux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    --cc=viro@math.psu.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.