EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Upgrading from CBSF3 to CBFS4

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#24734
Posted: 04/29/2013 10:41:50
by Ivan P (Priority Standard support level)
Joined: 04/11/2011
Posts: 66

We recently switched to new CBFS v4 dirver.

One of new properties in v4 is CaseSensitiveFileNames.

Our back-end storage, while being case-sensitive, do not support obtaining real file name by case-insensitive name.

In CBFS v3 we didn't have any problems with that excluding some small number of applications (for example, IIS server that requests for upper-case filenames).

I'd expect CBFS4 with CaseSensitiveFileNames=OFF to work the same as CBFS3. However there're differences. Consider the following case:
1. Create a new text document 'New Text document.txt' with Windows Explorer
2. Open it in WordPad.exe
In CBFSv3 it works good - all requests are executed for case-sensitive file name 'New Text document.txt'
In CBFSv4 some requests (specifically GetFileInfo) goes in upper-case: 'NEW TEXT DOCUMENT.TXT'

I'd think this is a WordPad issue (that requests for upper-case filenames), but under CBFSv3 it works well.

We have disabled all caches (that are new in CBFS4) :
FileCacheEnabled = false;
MetaDataCacheEnabled = false;
NonexistentFilesCacheEnabled = false;

I suppose that CBFS v3 might cached case-sensitive filename, but there were no option to turn it off. Is it correct?
How should we set cache-related properties to be more CBFSv3-like?
Is it possible to have LESS calls to OnCbfsGetFileInfo() with incorrect file case name?

Sincerely,
IP
#24738
Posted: 04/30/2013 02:03:48
by Volodymyr Zinin (EldoS Corp.)

The difference between ver.3 and 4 can be because for ver.3 some application has opened the file by it's "correct" name (i.e. "New Text document.txt") and this name has already been cached in the meta-data cache. And when the file is opened again by it's "upper case" name its real name is already present it the cache. But the same situation in the ver.4 handles slightly differently. And when another application tries to open the file via the name "NEW TEXT DOCUMENT.TXT" CallbackFS doesn't find this (or correct) name in the metadata cache and calls the OnGetFileInfo callback to obtain information about the file.

If your set CaseSensitiveFileNames to true then CallbackFS will ask about the real (case sensitive) file name in the OnGetFileInfo callback (via the RealFileName parameter).

Quote
Ivan P wrote:
I suppose that CBFS v3 might cached case-sensitive filename, but there were no option to turn it off. Is it correct? How should we set cache-related properties to be more CBFSv3-like?

CallbackFS v3, as I remember, doesn't completely support case sensitivity. Although it knows about it and tries to handle it maximally correctly as possible. On the other hand CallbackFS v4 completely supports case sensitivity.

Quote
Ivan P wrote:
Is it possible to have LESS calls to OnCbfsGetFileInfo() with incorrect file case name?

Perhaps during directory enumeration you returned "NEW TEXT DOCUMENT.TXT" and that's why an application tries to open the file with such upper case name. Or it's the application itself which converts the file name to upper case before openeing. Run Process Monitor from sysinternals.com and see the logs. Try to find the reason of such behavior.
But it's better to set CaseSensitiveFileNames to true. It isn't necessary to support case sensitivity "completely", but at least it can influences on behavior of programs (how they open files). Because when CaseSensitiveFileNames is set the CallbackFS driver sets for virtual disks two system attributes FILE_CASE_SENSITIVE_SEARCH and FILE_CASE_PRESERVED_NAMES.
FILE_CASE_PRESERVED_NAMES - "The file system preserves the case of file names when it places a name on disk".
FILE_CASE_SENSITIVE_SEARCH - "The file system supports case-sensitive file names when looking up (searching for) file names in a directory."
#24743
Posted: 04/30/2013 06:54:48
by Ivan P (Priority Standard support level)
Joined: 04/11/2011
Posts: 66

Quote
Perhaps during directory enumeration you returned "NEW TEXT DOCUMENT.TXT"

The most interesting thing that I don't. I thought it might be Wordpad, but with CBFSv3 we don't receive any upper-case calls (we log every callback call)

When I run ProcMon on CBFSv3 I see no upper-case calls.
When I run ProcMon on CBFSv4 with CaseSens=OFF, I do see GetFileInfo with upper-case, but also see that directory enumeration returns correct case

When I switch CBFSv4 to CaseSens=ON, I don't receive any upper-case in callbacks.

I attached 2 ProcMon logs:
1st - CaseSens =false, you can see some UPPER-CASE calls to NEW TEXT DOCUMENT.
Logfile_CaseSensOFF.PML - http://chilp.it/ba9300

2nd - CaseSens = true. No upper-case calls.
Logfile_CaseSensON.PML - http://chilp.it/f78b55

The code is the same (except of the CaseSensitiveFileNames setting)

If it were WordPad who tries to open upper-case names, I'd expect same upper case calls in both versions.
#24744
Posted: 04/30/2013 07:10:28
by Volodymyr Zinin (EldoS Corp.)

Why not to set CaseSensitive to true?

Quote
Ivan P wrote:
If it were WordPad who tries to open upper-case names, I'd expect same upper case calls in both versions.

It seems the reason is the following - "Because when CaseSensitiveFileNames is set the CallbackFS driver sets for virtual disks two system attributes FILE_CASE_SENSITIVE_SEARCH and FILE_CASE_PRESERVED_NAMES."
The same behavior was in CallbackFS v3.
#24746
Posted: 04/30/2013 07:19:30
by Ivan P (Priority Standard support level)
Joined: 04/11/2011
Posts: 66

Well, we are in the process of moving from v3 to v4, and we are trying to make as few changes as possible for the first time. Then we'll advance to new features.

Thanks for details explanations. We will use CaseSensitive = true.
We just don't know all the implications of setting this property.
At the moment we have our internal metadata cache, and filename comparison is case-insensitive. Should we switch all comparers to case-sensitive or better to leave it case-insensitive?
#24747
Posted: 04/30/2013 07:41:54
by Volodymyr Zinin (EldoS Corp.)

By setting case sensitivity to true you can still work with file names in your callbacks as case insensitive.
The problem can be if Windows "switches on" case sensitivity (by setting special flag in the registry) and "case sensitive" applications (actually from the unix/interix subsystem) try to create several files with the same file name, which are only "case sensitively" different.
Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.

Reply

Statistics

Topic viewed 1526 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!