EldoS | Feel safer!

Software components for data protection, secure storage and transfer

AddMountingPoint: CBFS_SYMLINK_NETWORK - Refresh view ?

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#29548
Posted: 05/23/2014 12:47:36
by Madhan Kanagavel (Standard support level)
Joined: 05/23/2014
Posts: 4

Hi,
We have an application that exposes a remote network server as a local drive using CBFS.

Currently we have set the mount point with CBFS_SYMLINK_NETWORK and it works fine.

The problem we have is that is if a user has a folder open and if the remote server has newer files in that folder, then the only way the local folder will show is when the user hits the refresh button (unlike other network drives like samba mounts.

Is there any other flag we should use for the OS to request periodic refresh of the current local folder?
#29549
Posted: 05/23/2014 13:26:03
by Eugene Mayevski (Team)

The OS doesn't refresh anything periodically. When you have something to tell the OS, you can do this by calling NotifyDirectoryChange() method of CallbackFileSystem class. It's up to you how to track changes on the remote location. Once you detect such changes, call NotifyDirectoryChange() and CBFS will tell the OS that the OS needs to do what's needed.


Sincerely yours
Eugene Mayevski
#29550
Posted: 05/23/2014 13:28:06
by Madhan Kanagavel (Standard support level)
Joined: 05/23/2014
Posts: 4

Got it! Thanks Eugene
#29551
Posted: 05/23/2014 15:58:44
by Madhan Kanagavel (Standard support level)
Joined: 05/23/2014
Posts: 4

Hi Eugene,
Just to confirm:

I have a folder with the drive path as \My Files and it has 3 files.

In the server, if I add or remove files to that folder, I should be calling

NotifyDirectoryChange(folder to be refreshed in view, CallbackFileSystem::CbFsNotifyFileAction::fanModified,false);

I notice that when doing that, I only see getFileInfo being called for that folder after NotifyDirectoryChange but no enumerateFolder calls follow, is it because the "access time" is not changed for the folder?
#29552
Posted: 05/23/2014 16:04:22
by Volodymyr Zinin (Team)

NotifyDirectoryChange must be called for all files/directories that are added/removed/modified outside CBFS. I.e. something like this:
NotifyDirectoryChange("\folder1\folder2\file.ext", CallbackFileSystem::CbFsNotifyFileAction::fanModified,false);
#29553
Posted: 05/23/2014 17:49:58
by Madhan Kanagavel (Standard support level)
Joined: 05/23/2014
Posts: 4

Got it. Thanks you Volodymyr.
#39059
Posted: 05/01/2017 21:11:45
by Barry Leslie (Basic support level)
Joined: 04/07/2017
Posts: 8

Hi,

I have a related problem.

In my app the content of the file system can dynamically change outside of normal file system access so I am using NotifyDirectoryChange() to notify the system of these changes.

If I add or delete a file NotifyDirectoryChange() refreshes the screen correctly but if a file is renamed so that I need to call

NotifyDirectoryChange("\folder1\foo.txt", CallbackFileSystem::CbFsNotifyFileAction::fanRemoved,false);

NotifyDirectoryChange("\folder1\bar.txt", CallbackFileSystem::CbFsNotifyFileAction::fanAdded,false);

"\folder1\bar.txt" appears correctly but
"\folder1\foo.txt" remains visible until I manually refresh the screen.

I can see in my log that it is making a call to reread the content of \folder1 and I am returning the correct content.

My filesystem is mounted on a drive with:
AddMountingPoint(mounting_point, CBFS_SYMLINK_SIMPLE | CBFS_SYMLINK_LOCAL, NULL);
#39060
Posted: 05/02/2017 00:26:29
by Eugene Mayevski (Team)

Thre are several reasons for such behavior possible:
1) a bug in the metadata cache. Please turn it off using MetaDataCacheEnabled property and see if the issue persists.
2) an issue in your implementation, which reports the existence of the file at the moment when it is renamed. To check the possibility can use Process Explorer tool by SysInternals to see, what requests are sent to your disk after the file is renamed and you have called NotifyDirectoryChange.
3) a glitch in Explorer that keeps showing the orphan file until you press F5. You can check this case by listing the directory in the command line after renaming the file.


Sincerely yours
Eugene Mayevski
#39092
Posted: 05/03/2017 16:54:07
by Barry Leslie (Basic support level)
Joined: 04/07/2017
Posts: 8

It looks like it is a glitch in Explorer.

I turned off the metadata cache but that had no effect.

Using a DOS shell I listed the folder contents and it was correct while explorer showed the old file name as well as the new file name.

I am logging where I call NotifyDirectoryChange() as well as when the call to read the directory contents and I can see that the directory is being read after the NotifyDirectoryChange call and it is returning the correct file names.

I even tried putting a 2 second sleep between calls to NotifyDirectoryChange()as well as calling NotifyDirectoryChange() with the 'wait' parameter both true and false.

NotifyDirectoryChange() is being called outside of a callback or event handler.

It is as if the back to back calls to NotifyDirectoryChange() some how result in the deleted file being displayed.

I have run out of ideas.
#39093
Posted: 05/04/2017 01:51:20
by Eugene Mayevski (Team)

Are you running the code that calls NotifyDirectoryChange in the service or in the UI application?

Unfortunately, if you see the changes in the command-line, the glitch is indeed specific to Explorer, and we have little influence over Explorer.


Sincerely yours
Eugene Mayevski
Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.

Reply

Statistics

Topic viewed 7061 times

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




|

Back to top

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

Got it!