All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@zip.com.au>
To: Luigi Genoni <kernel@Expansa.sns.it>
Cc: linux-kernel@vger.kernel.org
Subject: Re: ext2 related,two oops with 2.5.12 on ATA66 disk.
Date: Fri, 03 May 2002 13:55:09 -0700	[thread overview]
Message-ID: <3CD2F92D.6B3C1648@zip.com.au> (raw)
In-Reply-To: <Pine.LNX.4.44.0205031112060.6202-100000@Expansa.sns.it>

Luigi Genoni wrote:
> 
> HI,
> 
> this morning, going at work, I found those two oops (repeated a lto of
> times), on the Pentium III 512MB ram, i810 chipset, Maxtor 32049H2 ATA66
> disk.
> 
> buffer layer error at buffer.c:1380
> 

Yup, thanks.  dirty, uptodate, unmapped buffer outside
i_size.  I have a few fixes in the works; the below
one should make this go away.


--- 2.5.13/mm/page-writeback.c~writepage-versus-set_page_dirty	Fri May  3 00:48:13 2002
+++ 2.5.13-akpm/mm/page-writeback.c	Fri May  3 00:48:13 2002
@@ -475,8 +475,13 @@ int __set_page_dirty_buffers(struct page
 		struct buffer_head *bh = head;
 
 		do {
-			if (buffer_uptodate(bh))
+			if (buffer_uptodate(bh)) {
+				if (!buffer_mapped(bh))
+					buffer_error();
 				set_buffer_dirty(bh);
+			} else {
+				buffer_error();
+			}
 			bh = bh->b_this_page;
 		} while (bh != head);
 	}
--- 2.5.13/fs/buffer.c~writepage-versus-set_page_dirty	Fri May  3 00:48:13 2002
+++ 2.5.13-akpm/fs/buffer.c	Fri May  3 00:48:43 2002
@@ -1290,6 +1290,16 @@ static int __block_write_full_page(struc
 					(1 << BH_Dirty)|(1 << BH_Uptodate));
 	}
 
+	/*
+	 * Be very careful.  We have no exclusion from __set_page_dirty_buffers
+	 * here, and the (potentially unmapped) buffers may become dirty at
+	 * any time.  If a buffer becomes dirty here after we've inspected it
+	 * then we just miss that fact, and the page stays dirty.
+	 *
+	 * Buffers outside i_size may be dirtied by __set_page_dirty_buffers;
+	 * handle that here by just cleaning them.
+	 */
+
 	block = page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits);
 	head = page_buffers(page);
 	bh = head;
@@ -1300,8 +1310,7 @@ static int __block_write_full_page(struc
 	 */
 	do {
 		if (block > last_block) {
-			if (buffer_dirty(bh))
-				buffer_error();
+			clear_buffer_dirty(bh);
 			if (buffer_mapped(bh))
 				buffer_error();
 			/*
@@ -1329,11 +1338,9 @@ static int __block_write_full_page(struc
 
 	do {
 		get_bh(bh);
-		if (buffer_dirty(bh)) {
+		if (buffer_mapped(bh) && buffer_dirty(bh)) {
 			lock_buffer(bh);
-			if (buffer_dirty(bh)) {
-				if (!buffer_mapped(bh))
-					buffer_error();
+			if (test_clear_buffer_dirty(bh)) {
 				if (!buffer_uptodate(bh))
 					buffer_error();
 				set_buffer_async_io(bh);
@@ -1355,7 +1362,6 @@ static int __block_write_full_page(struc
 	do {
 		struct buffer_head *next = bh->b_this_page;
 		if (buffer_async(bh)) {
-			clear_buffer_dirty(bh);
 			submit_bh(WRITE, bh);
 			nr_underway++;
 		}

  reply	other threads:[~2002-05-03 20:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-03  9:17 ext2 related,two oops with 2.5.12 on ATA66 disk Luigi Genoni
2002-05-03 20:55 ` Andrew Morton [this message]
2002-05-04  1:01   ` Luigi Genoni

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=3CD2F92D.6B3C1648@zip.com.au \
    --to=akpm@zip.com.au \
    --cc=kernel@Expansa.sns.it \
    --cc=linux-kernel@vger.kernel.org \
    /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.