[lkml]   [2000]   [Jul]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectPATCH: linux-2.4.0-test5-pre4: cramfs corrupts ramdisk data

cramfs was calling bforget() on every block that it read.
bforget() has a side effect of causing the corresponding block of a
ramdisk to be filled with zeroes.

At first, I thought the correct fix was to change bforget to
just do a brelse if a page was marked with BH_Protected. However, on
closer inspection, it appears that everywhere else in the kernel
where bforget is called, it really is OK to wipe out the underlying
data (basically, deleted blocks). This is actually quite useful
for, say, a writable ext2 filesystem on a ramdisk device. So, I believe
the correct fix is for cramfs to call brelse instead of bforget.

I have attached the patch below.

Adam J. Richter __ ______________ 4880 Stevens Creek Blvd, Suite 104 \ / San Jose, California 95129-1034
+1 408 261-6630 | g g d r a s i l United States of America
fax +1 408 261-6631 "Free Software For The Rest Of Us."
---------------------------CUT HERE----------------------------------------

diff -u linux-2.4.0-test5-pre4/fs/cramfs/inode.c linux/fs/cramfs/inode.c
--- linux-2.4.0-test5-pre4/fs/cramfs/inode.c Tue May 23 14:52:18 2000
+++ linux/fs/cramfs/inode.c Sun May 28 01:38:13 2000
@@ -142,7 +142,7 @@
struct buffer_head * bh = bh_array[i];
if (bh) {
memcpy(data, bh->b_data, PAGE_CACHE_SIZE);
- bforget(bh);
+ brelse(bh);
} else
memset(data, 0, PAGE_CACHE_SIZE);
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:57    [W:0.036 / U:0.608 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site