lkml.org 
[lkml]   [2002]   [Jan]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] tail data corruption on mempressure
Hello!

This patch fixes a bug when mmap-write to a file tail and subsequent read cause written data to be lost
due to page-cache interacting mistake in low number of free buffers situation.
Please apply.

Bye,
Oleg
--- linux/fs/reiserfs/inode.c.orig Thu Dec 20 11:07:05 2001
+++ linux/fs/reiserfs/inode.c Thu Dec 20 19:03:51 2001
@@ -325,6 +325,16 @@
*/
if (buffer_uptodate(bh_result)) {
goto finished ;
+ } else
+ /*
+ ** grab_tail_page can trigger calls to reiserfs_get_block on up to date
+ ** pages without any buffers. If the page is up to date, we don't want
+ ** read old data off disk. Set the up to date bit on the buffer instead
+ ** and jump to the end
+ */
+ if (Page_Uptodate(bh_result->b_page)) {
+ mark_buffer_uptodate(bh_result, 1);
+ goto finished ;
}

// read file tail into part of page
@@ -833,7 +843,7 @@
}
if (retval == POSITION_FOUND) {
reiserfs_warning ("vs-825: reiserfs_get_block: "
- "%k should not be found\n", &key);
+ "%K should not be found\n", &key);
retval = -EEXIST;
if (allocated_block_nr)
reiserfs_free_block (&th, allocated_block_nr);
\
 
 \ /
  Last update: 2005-03-22 13:15    [W:0.053 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site