EldoS | Feel safer!

Software components for data protection, secure storage and transfer

CBFS NotifyDirectoryChange Wiondows Explorer not showing updates

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.
#32658
Posted: 03/18/2015 11:37:43
by Paolo Manili (Basic support level)
Joined: 02/23/2015
Posts: 16

Hi,

our CBFS based solution backs CBFS callbacks with a Database, and we regularly receive remote updates to the data from our server.
We refresh our local caches and our understanding is that to notify CBFS (and windows) about external changes we should use "notifydirectorychange" (per documentation) specifying a mountpoint-relative case sensitive path.

We read through the forum posts regarding the topic.
Very often though explorer windows open on the CBFS paths fail to update with the changes. We are working with Windows 8.1 but will paln to support 7 to 10 eventually.

On manual refresh the correct data is displayed, so logically, cbfs and the cache should be aligned.

Is there anything we are missing? should we be calling SHChangeNotify manually or searching and refreshing shell windows?

Thanks in advance,
Paolo Manili
#32659
Posted: 03/18/2015 11:53:08
by Eugene Mayevski (EldoS Corp.)

Do you have a Windows service doing the job? If yes, then you need to install Mount Notifier DLL (see the options in Install method parameters).


Sincerely yours
Eugene Mayevski
#32746
Posted: 03/25/2015 04:30:20
by Paolo Manili (Basic support level)
Joined: 02/23/2015
Posts: 16

Hi,sorry for the delay in the reply.
We have added the MountNotifier to the Driver installation.
No we are currently calling NotifyDirectoryChange from outside of the callbacks in the same application.
Should the calls be performed by a different service altogether?
We get true as a result of these calls but this does not always trigger explorer shell windows to refresh to show the new content.
We are currently forcing explorer to refresh paths by calling SHChangeNotify with the Update_Item value on the changed items.
This seems to cover correctly add/remove/rename operations for files and folders.
One call that we still have problems with is Folder remove, as although folders inside a path opened in explorer disappear correctly, if an explorer windows is pointed to a now non-existent folder we have not yet succeded in forcing a refresh.

We have the same problem when we unmount the drive. The opened folders remain and remain populated.

We have also now reduced NotifyDirectoryChange fanModified calls to a minimum as we found that the invalidated handles would cause explorer to stop copy/move/write operations on subpaths.

Are we missing something?
Yours sincerely,
Paolo Manili
#32747
Posted: 03/25/2015 04:38:27
by Eugene Mayevski (EldoS Corp.)

Quote
paolo.manili wrote:
No we are currently calling NotifyDirectoryChange from outside of the callbacks in the same application. Should the calls be performed by a different service altogether?


It's fine to call NotifyDirectoryChange where the call occurs.

Is the problem reproducible with some sample code (or maybe you can give a test case which exposes the problem)?

Quote
paolo.manili wrote:
We have also now reduced NotifyDirectoryChange fanModified calls to a minimum as we found that the invalidated handles would cause explorer to stop copy/move/write operations on subpaths.


This is the expected behavior - if you tell Windows that contents of the directory have been changed, handles to subdirectories are closed.


Sincerely yours
Eugene Mayevski
#33071
Posted: 04/20/2015 03:57:18
by Paolo Manili (Basic support level)
Joined: 02/23/2015
Posts: 16

Hi,

sorry for the delay (We got sidetracked by other issues).
We have reduced and delayed the fanModified calls on folders and that solved most of the problem.

We still have a problem with Explorer windows not being refreshed/ closed when the observed folder is removed or the FS unmounted.

It is reproducible with the Mapper sample, the driver is installed with these flags CallbackFileSystem.CBFS_MODULE_NET_REDIRECTOR_DLL | CallbackFileSystem.CBFS_MODULE_MOUNT_NOTIFIER_DLL.

I might add that we are mounting on a folder rather than a drive letter.

When we delete the storage/unmount the drive, the root folder, if open, becomes empty however explorer windows opened on child folders stay open.
We are running on Windows 8.1 x64.

Yours sincerely,
Paolo Manili
#33074
Posted: 04/20/2015 04:26:24
by Eugene Mayevski (EldoS Corp.)

Thank you for additional details. The fact that you are mounting to the folder changes everything -- the mechanism of notifying the OS about devices doesn't work for folders which have been set as reparse points.

I have moved your message to the HelpDesk so that you could track the progress of the issue, and the issue itself will be checked by our developers.


Sincerely yours
Eugene Mayevski
#37995
Posted: 10/26/2016 04:03:30
by Iulian Rotaru (Standard support level)
Joined: 08/19/2015
Posts: 1

Hi all,
we have a similar situation with NotifyDirectoryChange.
We are showing our data under a mounted folder and sometimes the OnEnumerateDirectory is not fired after
we have called NotifyDirectoryChange for the given file.
Moreover there is a peculiar thing:
if we have 2 directories:
1. "\\dirA\\somefile.txt"
and
2. "\\dirA\dirB\\whateverfile.txt"
than issuing a NotifyDirectoryChange for "\\dirA\\somefile.txt" we don't receive OnEnumerateDirectory event.
but for "\\dirA\dirB\\whateverfile.txt" we get notifications most of the time.

Is there anything different for the first case , why cbfs is not firing OnEnumerateDirectory ?

Thanks.

OS: win10 64 bit.
FS driver version: v.6.1.182
Language: C++.
#38001
Posted: 10/27/2016 03:02:28
by Volodymyr Zinin (EldoS Corp.)

Explorer (or another application), when it wants to be notified about file/directory changes, calls the system API ReadDirectoryChangesW. Then when the notification comes Explorer usually reenumerates the changed files. The reason why the enumeration doesn't occur in your case can be different. The problem can be either in Explorer or in interaction with some third party software or in CBFS.
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.

Reply

Statistics

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