fix file system corruption under load
PATCH 1/1 fix file system corruption under load
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..)
fs/buffer.c +9 -5
@@ -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);