lkml.org 
[lkml]   [2000]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patches in this message
/
Date
From
SubjectBug in fs/block_dev.c in 2.2.14 and 2.3.42
  Hello.

I've found a small bug in fs/block_dev.c. The problem is that when read_ahead of disk
is smaller than twice blocksize (which is true for my disk on 4kb blocksize) then
no block is read. That results in !uptodate buffer and possible data corruption.
Small patch is attached.

Honza.

--- linux/fs/block_dev.c Sun Jan 16 23:39:56 2000
+++ linux/fs/block_dev.c Thu Feb 10 01:14:11 2000
@@ -84,7 +84,7 @@
else
{
bhlist[0] = bh;
- if (!filp->f_reada || !read_ahead[MAJOR(dev)]) {
+ if (!filp->f_reada || read_ahead[MAJOR(dev)] < (blocksize >> 9) * 2) {
/* We do this to force the read of a single buffer */
blocks = 1;
} else {--- linux/fs/block_dev.c Sun Jan 16 22:06:21 2000
+++ linux/fs/block_dev.c Thu Feb 10 01:11:55 2000
@@ -76,7 +76,7 @@

if (chars != blocksize && !buffer_uptodate(bh)) {
if(!filp->f_reada ||
- !read_ahead[MAJOR(dev)]) {
+ read_ahead[MAJOR(dev)] < (blocksize >> 9) * 2) {
/* We do this to force the read of a single buffer */
brelse(bh);
bh = bread(dev,block,blocksize);
\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.029 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site