EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Queries reagrding usesystemcache, file information and directory infor

Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.
#12047
Posted: 01/05/2010 07:31:48
by Mezeo Support (Basic support level)
Joined: 12/29/2009
Posts: 40

I am testing our file system developed using callback framework for IFS test. Please find queries below regarding same

1 Does OnCloseFile map to IRP_MJ_CLEANUP or IRP_MJ_CLOSE ?

2 I set CallAllOpenCloseCallbacks to false, I open a file twice I will get only one callback for Creating a file.
For second open, access cheking needs to be done. Is it done at the driver level ?

3 I have not found documentation for usesystemcache but I got couple of references through forum which says there is no difference in behaviour except additional work to avoid dead locks. (No difference meaning setting usesystemcache true/false uses cache manager interfaces and also supports memory mapping) But I observed stale data issue. Let me put my observations in detail.

I wrote a test utility which will

1 open file a.dat
2 write 4K data to it with character 'a'
3 create file mapping handle
4 close file handle
5 Map view of file from 0 to 8K
6 Write all data with character 'b'
7 open file a.dat
8 Read 8K of data
9 close file handle
10 close file mapping handle

When I ran above test util with usesysemcache true, data read in step 8 contains 'b' character whereas with usesysemcache true, data read in step 8 contains 'a' character. The behaviour seems inconsistent with documentation.
On ntfs, data read in step 8 contains 'b' character.

4 I observed file information retuturned by querying file information and by querying directory information doesnt match

I wrote one more test utility which will

1 open file handle to a.dat
2 write 4K data to it with character 'a' using above file handle
3 Gets basic file information using GetFileInformationByHandleEx using above file handle
4 Set creation, lastaccesstime using SetFileInformationByHandle using above file handle
5 Close File handle
6 open file handle to a.dat
7 Gets FILE_BASIC_INFO information using GetFileInformationByHandleEx using above file handle
8 Observed time stamps from basic file info
9 close file handle
10 open handle to parent diretory where a.dat resides
11 Get FILE_ID_BOTH_DIR_INFO using GetFileInformationByHandleEx using above file handle
12 Observed time stamps for a.dat

I ran the utlity on ntfs and our filesystem developed using callback framework. On ntfs, FILE_BASIC_INFO and FILE_ID_BOTH_DIR_INFO timestamps match to what I set in SetFileInformationByHandle. But for our filessystem, FILE_BASIC_INFO timestamps match to what I set in SetFileInformationByHandle whereas FILE_ID_BOTH_DIR_INFO is almost same to current time.
#12068
Posted: 01/07/2010 02:52:45
by Volodymyr Zinin (EldoS Corp.)

Sorry for the delay. I will answer a little later...
#12076
Posted: 01/07/2010 14:17:14
by Volodymyr Zinin (EldoS Corp.)

Quote
Mayur Thigale wrote:
1 Does OnCloseFile map to IRP_MJ_CLEANUP or IRP_MJ_CLOSE ?

It's associated with IRP_MJ_CLOSE because after the IRP_MJ_CLEANUP request but before the IRP_MJ_CLOSE call there can be other file i/o requests (such as delayed paging IRP_MJ_WRITE).

Quote
Mayur Thigale wrote:
2 I set CallAllOpenCloseCallbacks to false, I open a file twice I will get only one callback for Creating a file. For second open, access cheking needs to be done. Is it done at the driver level ?

Yes, the desired access as well as the share access is checked by CallbackFS internally. You can perform an additional checking but in this case CallAllOpenCloseCallbacks should be set to TRUE.

Quote
Mayur Thigale wrote:
3 I have not found documentation for usesystemcache but I got couple of references through forum which says there is no difference in behaviour except additional work to avoid dead locks. (No difference meaning setting usesystemcache true/false uses cache manager interfaces and also supports memory mapping) But I observed stale data issue. Let me put my observations in detail.
...

This flag is obsolete and doesn't influence at all.
I've tried the test you specified and observed strange behavior - when the test is performed in the debug "step-by-step" mode then the bug is occurred, in the other case - not. CallbackFS takes into account the situation when a file is accessed simultaneously via the "standard" file i/o as well as via memory mapped sections. And in case of your test during the step 8 CallbackFS performs the system cache flushing (by calling CcFlushCache) for the memory mapped file's data before the data will be read. But during the step-by-step debugging this flushing doesn't "work" - i.e. the CcFlushCache call returns with success but the system doesn't flush anything.
Please tell me if the problem occurs during the "usual work".

Quote
Mayur Thigale wrote:
4 I observed file information retuturned by querying file information and by querying directory information doesnt match ...

Does the problem occur on the Mapper sample? I've checked the test you specified with this sample but couldn't reproduce.
#12086
Posted: 01/11/2010 07:08:26
by Mezeo Support (Basic support level)
Joined: 12/29/2009
Posts: 40

Quote
Vladimir Zinin wrote:
It's associated with IRP_MJ_CLOSE because after the IRP_MJ_CLEANUP request but before the IRP_MJ_CLOSE call there can be other file i/o requests (such as delayed paging IRP_MJ_WRITE)


It seems CloseCleanupDelete group from IFS test can't be fixed from user mode code alone.

Quote
Vladimir Zinin wrote:
Does the problem occur on the Mapper sample? I've checked the test you specified with this sample but couldn't reproduce..


Till now I only observed allocation size difference in file and directory informatiob with a test program. Enumerate directory callback was modified to return allocation size in multiple of cluster size. This might resulted in above difference.

I faced couple of problems while working with Vmounter sample, I have client software installation on the machine but not started the their application.I have put the trial kay in Vmounter sample as my account license key. When I run the vmounter, I got error message saying "Process cant access file because it is being used by another process"

I took a fresh machine, dowmnloded your setup and tried with license kay I have. Driver installtion succeeded but create storage failed, saying invalid license key. Do I need to use any different key or I missed something ?
#12087
Posted: 01/11/2010 12:42:40
by Volodymyr Zinin (EldoS Corp.)

Quote
Mayur Thigale wrote:
It seems CloseCleanupDelete group from IFS test can't be fixed from user mode code alone.

What is the problem that is necessary to fix?

Quote
Mayur Thigale wrote:
Till now I only observed allocation size difference in file and directory informatiob with a test program. Enumerate directory callback was modified to return allocation size in multiple of cluster size. This might resulted in above difference.

As I wrote in another your forum topic we are going to correct work with allocation size in the nearest build. The driver will round it to the cluster size.

Quote
Mayur Thigale wrote:
When I run the vmounter, I got error message saying "Process cant access file because it is being used by another process"

You can use Process Monitor from sysinternals.com to find what an operation causes the error. Set a filter there to show only the "VMounter.exe" process' operations.
#12093
Posted: 01/12/2010 02:19:32
by Mezeo Support (Basic support level)
Joined: 12/29/2009
Posts: 40

Quote
You can use Process Monitor from sysinternals.com to find what an operation causes the error. Set a filter there to show only the "VMounter.exe" process' operations.


I tried with Process Monitor I observed cbfs.sys exclusive open failed with SHARING_VIOLATION. Is there any tool by which I can check who's using that file ? I tried with handle utility but no process opened cbfs.sys. If Cbfs driver already started then what is the behavior of Vmounter in install driver

I also observed CreateFileMapping for imageres.dll failed with FILE_LOCKED_WITH_ONLY_READERS. imageres.dll was opened with GENERIC_READ access, read delete as shared mode.

en-US\imageres.dll.mui was opened with GENERIC_READ access, read delete as shared mode.CreateFileMapping for imageres.dll.mui with page protection as PAGE_WRITECOPY failed with FILE_LOCKED_WITH_ONLY_READERS.

I observed this on Vista setup. What could be going wrong ?
#12094
Posted: 01/12/2010 02:33:27
by Volodymyr Zinin (EldoS Corp.)

Quote
Mayur Thigale wrote:
Is there any tool by which I can check who's using that file ?

I use for it another utility from sysinternals.com - Process Explorer. Click there on the menu Find->"Find handle or dll...".

Quote
Mayur Thigale wrote:
en-US\imageres.dll.mui was opened with GENERIC_READ access, read delete as shared mode.CreateFileMapping for imageres.dll.mui with page protection as PAGE_WRITECOPY failed with FILE_LOCKED_WITH_ONLY_READERS.

Maybe the system doesn't like when the file mapping is being done with PAGE_WRITECOPY on a file handle obtained only for read.
Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.

Reply

Statistics

Topic viewed 4338 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!