i notice that SmbMRx sample redirector does NOT cache a file with a write
only open handle. Why? Is this a rule of CIFS protocol or a rule for all
redirectors?
Thanks.
I got bitten by this a few months ago, so here is my
take on the situation…
This is because the NT cache needs read access to the
file in order to work. The cache works on page-sized
chunks. If you open a file and write 1 byte at
location 0, and caching is enabled, the NT cache will
page-in the memory page representing the first 4096
bytes of the file, which requires it to issue a paging
I/O read for the first 4096 bytes. Then it will paste
in your new byte and mark the page dirty, which causes
the page to be written out later by the lazy writer.
For local files, paging I/O is allowed to bypass all
security checks (since only trusted kernel components
can issue paging I/O requests), so that paging reads
are allowed on all opens for all files. For network
files, there is no reason the remote PC should ‘trust’
your PC and grant it read access if you only have
write-access to the file. Therefore the NT cache
cannot be used on write-only remote files.
Check out the function
MRxSmbMungeBufferingIfWriteOnlyHandles in the smbmrx
sample code.
i notice that SmbMRx sample redirector does NOT
cache a file with a write only open handle. Why? Is
this a rule of CIFS protocol or a rule for all
redirectors? Thanks.
=====
- Nicholas Ryan
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/