All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@sgi.com>
To: marcelo@conectiva.com.br
Cc: linux-kernel@vger.kernel.org, cattelan@sgi.com
Subject: [PATCH] fix file system corruption under load
Date: Thu, 7 Nov 2002 19:04:41 -0500	[thread overview]
Message-ID: <20021107190441.A15691@sgi.com> (raw)

When QA testing XFS 1.2 we observed in-memory corruption under extreme
load (fsx, usemem & bash-shared-mapping) when using block size < pagesizes.

In addition to some bugs inside XFS Russell Cattelan found a problem in
end_buffer_io_async.

The problem is that end_buffer_io_async sets the page uptodate as soon
as there are no more async or locked buffers, which is wrong if only
parts of the page are submitted for I/O (i.e. writes not on the page
boundary, etc..)



--- linux-2.4/fs/buffer.c	Fri Oct  4 18:14:59 2002
+++ linux/fs/buffer.c	Thu Nov  7 16:09:53 2002
@@ -749,6 +749,7 @@
 	unsigned long flags;
 	struct buffer_head *tmp;
 	struct page *page;
+	int fullup = 1;
 
 	mark_buffer_uptodate(bh, uptodate);
 
@@ -775,8 +876,11 @@
 	unlock_buffer(bh);
 	tmp = bh->b_this_page;
 	while (tmp != bh) {
-		if (buffer_async(tmp) && buffer_locked(tmp))
-			goto still_busy;
+		if (buffer_locked(tmp)) {
+			if (buffer_async(tmp))
+				goto still_busy;
+		} else if (!buffer_uptodate(tmp))
+			fullup = 0;
 		tmp = tmp->b_this_page;
 	}
 
@@ -784,10 +824,10 @@
 	spin_unlock_irqrestore(&page_uptodate_lock, flags);
 
 	/*
-	 * if none of the buffers had errors then we can set the
-	 * page uptodate:
+	 * If none of the buffers had errors and all were uptodate
+	 * then we can set the page uptodate:
 	 */
-	if (!PageError(page))
+	if (fullup && !PageError(page))
 		SetPageUptodate(page);
 
 	UnlockPage(page);

                 reply	other threads:[~2002-11-07 16:43 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=20021107190441.A15691@sgi.com \
    --to=hch@sgi.com \
    --cc=cattelan@sgi.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 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.