Export (0) Print
Expand All

2.1.4.2 Algorithm for Detecting If Open Files Exist Within a Directory

The inputs for this algorithm are:

  • File: The DirectoryFile we inspect for open files.

  • Open: The Open for the request that is calling this algorithm.

  • Operation: A code describing the operation being processed, per section 2.1.4.12.

  • OpParams: Parameters associated with Operation, passed in from the calling request, per section 2.1.4.12.

The output is a Boolean. If the return value is TRUE, then no open files exist within the directory; if FALSE, then at least one open exists even after attempting to break oplocks.

Pseudocode for the algorithm is as follows:

  • For each OpenFile in File.Volume.OpenFileList:

    • If OpenFile.OpenList contains any elements with Link.ParentFile equal to File:

      • For each Stream in OpenFile.StreamList:

        • If Stream.Oplock is not empty and Stream.Oplock.State contains either BATCH_OPLOCK or HANDLE_CACHING, the object store MUST check for an oplock break according to the algorithm in section 2.1.4.12, with input values as follows:

          • Open equal to this algorithm's Open.

          • Oplock equal to Stream.Oplock.

          • Operation equal to this algorithm's Operation.

          • OpParams equal to this algorithm's OpParams.

        • EndIf

      • EndFor

    • EndIf

  • EndFor

  • // See if all oplock holders have gotten out of the way.

  • For each OpenFile in File.Volume.OpenFileList:

    • If OpenFile.OpenList contains any elements with Link.ParentFile equal to File:

      • Return FALSE // An open child still exists, deny the operation.

    • EndIf

  • EndFor

  • Return TRUE // No opens remaining.

 
Show:
© 2014 Microsoft