Skip to contentSkip to conversation

Invalidating buffer cache in dom0

DISCUSSION Jacob Gorm Hansen 1 participant 1 message May 27, 2005

lore
Share & tools
lore
#0 lore raw

hi,

I have a domU that dumps some data (a checkpoint) to a virtual device. Afterwards, I want to create a new domU based on that data, but because right now my domain bootstrapper does not have a disk driver, I first build a ramdisk which I give as an argument to my bootstrapper.

This all works fine, but I have the problem that I have to reboot dom0 between each run, because apparently dom0 Linux does not notice that the contents on disk have changed, and keep giving me stale data from its buffer cache when I create the ramdisk. I have tested that this is actually what happens by grepping for a string in the block device (/dev/hda5), and the value of the string changes between reboots.

Does anyone know of an ioctl or similar that I could use to make Linux forget about (not flush) buffer cache contents, or how to disable it?

I have tried reading from the block dev with O_DIRECT but that does not help.

Thanks,
Jacob