Re: Patch (repost): cramfs memory corruption fix

Linus Torvalds (torvalds@transmeta.com)
Sun, 7 Jan 2001 19:46:52 -0800 (PST)


On Sat, 6 Jan 2001, Adam J. Richter wrote:
>
> This sounds like a bug that I posted a fix for a long time ago.
> cramfs calls bforget on the superblock area, destroying that block of
> the ramdisk, even when the ramdisk does not contain a cramfs file system.
> Normally, bforget is called on block that really can be trashed,
> such as blocks release by truncate or unlink.

I'd really prefer just not letting bforget() touch BH_Protected buffers.
bforget() is also used by other things than unlink/truncate: it's used by
various partition codes etc, and it's used by the raid logic.

Now, nobody wants to use RAID on a ramdisk, but the fact is that
"bforget()" does not mean "forget the contents of this buffer", but it
really means "you can forget this cached copy even if it is dirty, we're
not likely to need it in the near future and can read it back in".

Also, if you care about memory usage, you're likely to be much better off
using ramfs rather than something like "ext2 on ramdisk". You won't get
the double buffering.

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/