Helen,
You can call MmFlushImageSection from within IRP_MJ_CLEANUP handler. If the
section object is already closed then MmFlushImageSection succeeds and memory
manager releases reference to the file object. If section object is still
exists it is not safe to overwrite file on the server side.
Alexei.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Helen Friedland
Sent: Friday, August 18, 2006 11:04 AM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] question about VMM and memory mapped files
Slava,
Thanks for the reply. I understand that I need to call MmFlushImageSection()
to flush the image section, but that wasn’t my question.
Let me try to explain the architecture a little bit better. I have a client
machine which is running my FS driver. The FS driver instead of going to the
disk of the client machine, goes to the server machine. I.e. none of the
files are local to the client. They are all on the server. On the server, I
have my own file server running that serves the requests that come from my
driver. (They use a proprietary protocol for communication). The way the
server does file operations – it just calls Win32 File IO APIs to the
underlying file system (NTFS).
The problem arises when a 3rd party application is trying to open a file on
the server machine. The 3rd party application does not use my file server, it
goes directly to the NTFS. Since my file server is bypassed, I have no idea
that someone else is trying to open the file. However, the 3rd party’s file
open doesn’t succeed because the file server has the file opened, since it
never received the close command from the client, since the client still has
the file opened because the VMM holds the reference to it.
I guess my question is, how is this handled on other networking/distributed
systems? In CIFS/NTFS world, if I run an executable that sits on the mapped
drive on one machine, and then compile it on another, it works. So somehow,
the VMM gets flushed. How is that implemented?
Thanks.
Helen.
Slava Imameyev wrote:
Hi,
MmFlushImageSection( …, MmFlushForWrite ) and CcPurgeCacheSection() delete
segment objects for the executable and data image if no any maps exist. The
file object is dereferenced then the segment is being deleted.
for example, the code from the fastfat:
Section = &Fcb->NonPaged->SectionObjectPointers;
DataSectionExists = (BOOLEAN)(Section->DataSectionObject !=
NULL);
ImageSectionExists = (BOOLEAN)(Section->ImageSectionObject !=
NULL);
//
// Note, it is critical to do the Image section first as the
// purge of the data section may cause the image section to go
// away, but the opposite is not true.
//
if (ImageSectionExists) {
(VOID)MmFlushImageSection( Section, MmFlushForWrite );
}
if (DataSectionExists) {
CcPurgeCacheSection( Section, NULL, 0, FALSE );
}
–
Slava Imameyev, xxxxx@hotmail.com
“Helen Friedland” < xxxxx@yahoo.com> wrote in message news:xxxxx@ntfsd…
Hi,
I was wondering if there’s a way for the file system driver to tell the
Virtual Memory Manager not to hold a reference to the memory mapped file
after it’s done with it, and instead send IRP_MJ_CLOSE right away.
Here is some background to the problem I’m trying to solve. We have our own
file system, which acts as a network redirector that sends file system
requests to the file server (using our own proprietary protocol). Currently,
we do not implement any client-side caching, but we do provide support for
memory mapped files. So the problem I’m facing is this. Say I ran an
executable on the client. After it finished running, I want to recompile the
same executable on the server. However, since the VMM on the client holds the
reference to the file, the server has never received the close command, so
the server has the file opened, so the compile fails because the complier
cannot write to the file.
The only way I can think of to solve this problem is to add oplock support.
So when the server receives the request from a client, it requests an oplock
from the underlying FS, and when a 3rd party application (i.e. the compiler)
tries to open the file for delete, I get the oplock break event and flush the
image section of the file on the server, and then the 3rd party application
can proceed.
Are there other ways of solving this problem? It seems that since oplocks are
opportunistic, I am not quaranteed that the oplock will be granted, and if it
is not, I’m back to square one.
Any advice is appreciated.
Thanks.
Helen.
Do you Yahoo!?
Get on board. You’re
http:isers> invited to try the new Yahoo! Mail Beta.
—
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com
_____________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com — Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17 You are currently subscribed to
ntfsd as: xxxxx@vmware.com To unsubscribe send a blank email to
xxxxx@lists.osr.com</http:>