There are a whole host of ugly nasty issues here, but the simplest one
to explain would be “memory mapped files”.
Write an application program that opens a file, memory maps it, closes
the open file and continues using the memory mapping. Cc functions
won’t DO anything because there is no cache manager state. Not even a
file system can fix this particular issue - once the data is in virtual
memory, it is *there*. If you want to GUARANTEE it goes away, reboot.
Dismounting and remounting the volume breaks the association of the file
with the contents in memory, which is the only way of which *I* know
will work 100% of the time - although the old data contents remain in
memory until that memory is recycled (but generally that won’t be too
long). If you want something that works sometimes, go ahead and use
CcFlushCache/CcPurgeCache - but at my core I’m a file systems developer,
and the answer “this only corrupts your data once in a while” is NOT
acceptable to me.
Theoretically, if you rendezvous all the processors (or otherwise
prevent them from opening your file while you are working) you could
walk through the handle tables of each process on the system and when
you find a process with an open handle to a section backed by your file,
or to your file itself, you could close the handle or kill the process
(my guess is if you close a handle on a process you might as well kill
it in most cases). This would require very specific knowledge of the
system to implement, create a highly noticeable “burp” in system
behavior, and likely create rather nasty side-effects (try randomly
killing processes on your system sometime) including spontaneous
reboots. Sounds like a debugging nightmare to me - and at the point you
have a significant chance of causing a BSOD you might as well just
reboot anyway.
As is often the case, however, when the questioner does not like the
answer they merely re-ask the question, perhaps in hope that the next
answer they receive will be more palatable.
Regards,
Tony
Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com
Looking forward to seeing you at the next OSR File Systems class in Los
Angeles, CA October 24-27, 2005.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ken Cross
Sent: Thursday, September 29, 2005 8:28 AM
To: ntfsd redirect
Subject: RE: [ntfsd] question
Are you sure that’s what you want? In the description of
CcPurgeCacheSection():
“If the data had been modified prior to the purge operation, the updates
to
the data are lost.”
You have already been told by Tony Mason that the only guaranteed way to
flush a file from cache to disk is to dismount the volume.
Ken
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@uow.edu.au
Sent: Thursday, September 29, 2005 8:19 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] question
filter irp_mj_write, change no data but setup completion
routine and in the routine call CcPurgeCacheSection() for the
file ?
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: xxxxx@comcast.net
To unsubscribe send a blank email to xxxxx@lists.osr.com
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to xxxxx@lists.osr.com