EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Reporting errors from flush and close

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.
#30280
Posted: 08/12/2014 09:01:01
by Stanisław Gąsiorowski (Basic support level)
Joined: 06/24/2014
Posts: 6

Hi,
I've come across a serious problem when developing filesystem with CallbackFS.

According to the documentation it's impossible to report an error from flush and close operations.
I am performing delayed network writes, so the only option to report an error is in close operation.

What is interesting, when I throw an error on every close operation, Windows Explorer informs me of error on... renaming a file!

Why reporting errors from flush and close is not supported?
Is there any way to report such an error or add this feature to CallbackFS?

Thanks.
#30281
Posted: 08/12/2014 09:03:39
by Eugene Mayevski (EldoS Corp.)

Windows doesn't expect (and ignore) errors on these stages. It's not possible to implement them.


Sincerely yours
Eugene Mayevski
#30282
Posted: 08/12/2014 09:10:48
by Stanisław Gąsiorowski (Basic support level)
Joined: 06/24/2014
Posts: 6

Thanks for super fast answer.

According to MSDN both fclose and CloseHandle can report errors...
This seems to be great flaw of Windows.

Do you have any suggestion how to implement delayed writes with error reporting?
#30284
Posted: 08/12/2014 09:17:03
by Eugene Mayevski (EldoS Corp.)

Those functions work on another level.

When the application writes data to the file, this data goes to the system cache. After the application closes the file the cache is flushed to the disk by the system cache manager and only after than the file is closed on the filesystem. The application has no way to know that the error has happened because the error (in your case) happens long after CloseHandle has been completed.


Sincerely yours
Eugene Mayevski
#30286
Posted: 08/12/2014 09:54:29
by Stanisław Gąsiorowski (Basic support level)
Joined: 06/24/2014
Posts: 6

Thanks for info.

I see that developing filesystem on Windows in which you can be sure data has been permanently written is not that easy.
#30414
Posted: 08/19/2014 04:51:45
by Stanisław Gąsiorowski (Basic support level)
Joined: 06/24/2014
Posts: 6

One more question, is OnCleanupFile called after CloseHandle is executed? Wouldn't it be possible to fail CloseHandle when OnCleanupFile throws an error?

One thing is strange: all throws from close and cleanup are displayed to the user on renaming file. Why is that?
#30437
Posted: 08/21/2014 02:15:58
by Volodymyr Zinin (EldoS Corp.)

The OnCleanupFile callback is optional. If you implement it then it will be always called synchronously when a file handle is being closed by the use of CloseHandle or ZwClose API. Unfortunately although these API have returned error parameter Windows doesn't expect that the handle closing operation can fail. We have experimented with this and tried to return error from the driver during the cleanup request handling, but Windows ignored any error.

Quote
tweety wrote:
One thing is strange: all throws from close and cleanup are displayed to the user on renaming file. Why is that?

During file renaming CBFS first calls the OnCleanup and OnClose callbacks for all openings of the the file, then calls the OnRename callback, and then the OnOpen callback for the renamed file (again for all openings). It isn't correct there that an error thrown from the OnCleanup and OnClose callbacks is taken into account there. We will correct it.
Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.

Reply

Statistics

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