Anybody know of a reliable way to cause buffer cache pages to be purged (not
written to disk, but released)??

Problem: In a shared disk environment, changes made by the owner (R/W) are
not seen by R/O sharers in a timely fashion.  This is especially problematic
when the Linux virtual machine has a sizable virtual memory size allowing it
to have lots of buffercache.  In small memory Linux images, the changes are
recognized fairly quickly, you can force by editing a sizeable file which
will cause the buffercache pages to be re-used (stolen).

I realize that this is unsafe in the general sense (writing to a minidisk
that is shared by others), but I believe that it is fairly safe in the usage
I am attempting.

Have tried several variations of commands on both the owner and sharers.
Sync'ing and even shutting down the owner (to make sure the buffers are
written) does not have any effect.  On the sharing systems, 'mount -o
remount', various other mount options and various blockdev options
(flushbufs, rereadpt) don't seem to help.  Interestingly enough, 'blockdev
--rereadpt'  will cause deleted files to be noticed immediately, but not
newly created files (I would have thought it wouldn't have affected either,
but was trying about anything!).

Have scoured some kernel code and believe there are routines that will do
what is needed.  Usually used when unmounting a device or some other act of
removing, but don't see a way to force them to be called via any system
call/command available.

Any ideas??

Cheers,
Mark

Reply via email to