All callback functions must perform fast in order not to block the whole system.
To prevent blocking the driver uses timeouts.
The timeout value is set globally as a parameter of MountMedia method. If the user-mode process takes too much time to process the callback request and timeout expires, the driver cancels the request and reports error to the OS.
If some callback needs more time to complete the operation, it can call ResetTimeout method for this particular call.
To make your code fast, don't perform lengthy operations (especially network operations) from the callback. Create a worker thread, that will do the job. When you need to write the data, pass this data to the worker thread and return. The worker thread will send the data to the remote side. When the file is opened, cache some of it's data with help of the worker thread and return this data from reading callback.