mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fix file system corruption under load
@ 2002-11-08  0:04 Christoph Hellwig
  0 siblings, 0 replies; only message in thread
From: Christoph Hellwig @ 2002-11-08  0:04 UTC (permalink / raw)
  To: marcelo; +Cc: linux-kernel, cattelan

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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-11-07 16:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-08  0:04 [PATCH] fix file system corruption under load Christoph Hellwig

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®