Write cache data-loss considerations when using oplocks

Contributors

Under some circumstances, if a process has an exclusive oplock on a file and a second process attempts to open the file, the first process must invalidate cached data and flush writes and locks. The client must then relinquish the oplock and access to the file. If there is a network failure during this flush, cached write data might be lost.

  • Data-loss possibilities

    Any application that has write-cached data can lose that data under the following set of circumstances:

    • The connection is made using SMB 1.0.

    • It has an exclusive oplock on the file.

    • It is told to either break that oplock or close the file.

    • During the process of flushing the write cache, the network or target system generates an error.

  • Error handling and write completion

    The cache itself does not have any error handling—​the applications do. When the application makes a write to the cache, the write is always completed. If the cache, in turn, makes a write to the target system over a network, it must assume that the write is completed because if it does not, the data is lost.