Messages in this thread Patches in this message | | | Date | Thu, 10 Feb 2000 00:21:16 +0100 | From | Jan Kara <> | Subject | Bug 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); | |