FILE_FLAG_OPEN_NO_RECALL and "Lease" Oplock

Hi,
FILE_FLAG_OPEN_NO_RECALL is generally used by archiving software to
optimize file restore. If a application is opening a file with
FILE_FLAG_OPEN_NO_RECALL then file is not fetched from secondary storage
but read directly from secondary storage. So in the following sequence:

  1. Application opens a file with FILE_FLAG_OPEN_NO_RECALL with first
    CreateFile() and asks for lease. File is not fetched from secondary storage.
  2. Application issues second CreateFile() with WRITE requests. In that case
    file need to be restored from secondary storage.
  3. To restore the file, ARCHIVING software also needs to open the file in
    WRITE mode.

Since “Lease” is held by application, so when ARCHIVING application opens a
WRITE handle to file, will that cause “Lease” to be broken. I am seeing
SHARING_VIOLATIONS when I try to open a file from ARCHIVING software. If
lease is broken then SHARING_VIOLATIONS should not come.

Thanks for help
Ash

Well, I guess that depends on the type of “Lease”. The application might simply ask for a lease in order to know whether it’s safe to cache the data it reads. Once the lease is broken the application might switch to a model where there is no caching since it knows there are writers. However, the archiving application might still fail if there are any open handles (depending on it’s sharing mode) so the lease won’t help with that scenario.

Perhaps you could add more information about the type of lease and the access and sharing mode on each application ?

Thanks,
Alex.