STATUS_OPLOCK_BREAK_IN_PROGRESS in PostOpCreate

Hello,

The documentation of the IRP_MJ_CREATE says the following.

==== Begin ====
If a filter or minifilter cannot honor the FILE_COMPLETE_IF_OPLOCKED flag, it must complete the IRP_MJ_CREATE request with STATUS_SHARING_VIOLATION.

If the FILE_COMPLETE_IF_OPLOCKED flag is set in the completion (post-create) path, the filter should check whether the file system has set Irp->IoStatus.Status to the STATUS_OPLOCK_BREAK_IN_PROGRESS status value. If this status value is not set, it is safe for the filter to initiate one of the above operations on the file. If this status value is set, the oplock has not yet been broken, and the filter must not initiate any operation that can cause an oplock break. Thus the filter must postpone all of the above operations on the file until one of the following conditions is true:
==== End ====

However, it’s not clear to me as to: If my filter just doesn’t want to do any further processing in case Irp->IoStatus.Status is set to STATUS_OPLOCK_BREAK_IN_PROGRESS, what do I need to do?

  1. Just return from PostOpCreate with FLT_POSTOP_FINISHED_PROCESSING?
  2. Set Irp->IoStatus.Status = STATUS_SHARING_VIOLATION and return from PostOpCreate with FLT_POSTOP_FINISHED_PROCESSING?
  3. Set Irp->IoStatus.Status = STATUS_SHARING_VIOLATION and cancel the file open using FltCancelFileOpen and then return FLT_POSTOP_FINISHED_PROCESSING?

Please advice.

Thanks.
-Prasad

#2 and #3 is impossible since you can not “complete” an operation on post
callback. FltCancelFileOpen is sort of rollback - not completion.

What you wanna do depends on your filter. Mine is a AV filter. I am riding
piggyback on the filtered FileObject. In case of
STATUS_OPLOCK_BREAK_IN_PROGRESS my filter will avoid subsequent operations
like “doing reads on that FileObject” by storing an OpLockBreakInProgess
flag in my Handle-Context. One may filter for FSCTL_OPLOCK_BREAK_NOTIFY to
reset this flag.

wrote news:xxxxx@ntfsd…

Hello,

The documentation of the IRP_MJ_CREATE says the following.

==== Begin ====
If a filter or minifilter cannot honor the FILE_COMPLETE_IF_OPLOCKED flag,
it must complete the IRP_MJ_CREATE request with STATUS_SHARING_VIOLATION.

If the FILE_COMPLETE_IF_OPLOCKED flag is set in the completion (post-create)
path, the filter should check whether the file system has set
Irp->IoStatus.Status to the STATUS_OPLOCK_BREAK_IN_PROGRESS status value. If
this status value is not set, it is safe for the filter to initiate one of
the above operations on the file. If this status value is set, the oplock
has not yet been broken, and the filter must not initiate any operation that
can cause an oplock break. Thus the filter must postpone all of the above
operations on the file until one of the following conditions is true:
==== End ====

However, it’s not clear to me as to: If my filter just doesn’t want to do
any further processing in case Irp->IoStatus.Status is set to
STATUS_OPLOCK_BREAK_IN_PROGRESS, what do I need to do?

  1. Just return from PostOpCreate with FLT_POSTOP_FINISHED_PROCESSING?
  2. Set Irp->IoStatus.Status = STATUS_SHARING_VIOLATION and return from
    PostOpCreate with FLT_POSTOP_FINISHED_PROCESSING?
  3. Set Irp->IoStatus.Status = STATUS_SHARING_VIOLATION and cancel the file
    open using FltCancelFileOpen and then return FLT_POSTOP_FINISHED_PROCESSING?

Please advice.

Thanks.
-Prasad

Yup, you got it. Just return FLT_POSTOP_FINISHED_PROCESSING (the first approach you listed). Make sure to free any things you may have allocate during preCreate (if any).

Thanks,
Alex.
On Jun 4, 2013, at 3:50 AM, xxxxx@vmware.com wrote:

Hello,

The documentation of the IRP_MJ_CREATE says the following.

==== Begin ====
If a filter or minifilter cannot honor the FILE_COMPLETE_IF_OPLOCKED flag, it must complete the IRP_MJ_CREATE request with STATUS_SHARING_VIOLATION.

If the FILE_COMPLETE_IF_OPLOCKED flag is set in the completion (post-create) path, the filter should check whether the file system has set Irp->IoStatus.Status to the STATUS_OPLOCK_BREAK_IN_PROGRESS status value. If this status value is not set, it is safe for the filter to initiate one of the above operations on the file. If this status value is set, the oplock has not yet been broken, and the filter must not initiate any operation that can cause an oplock break. Thus the filter must postpone all of the above operations on the file until one of the following conditions is true:
==== End ====

However, it’s not clear to me as to: If my filter just doesn’t want to do any further processing in case Irp->IoStatus.Status is set to STATUS_OPLOCK_BREAK_IN_PROGRESS, what do I need to do?

  1. Just return from PostOpCreate with FLT_POSTOP_FINISHED_PROCESSING?
  2. Set Irp->IoStatus.Status = STATUS_SHARING_VIOLATION and return from PostOpCreate with FLT_POSTOP_FINISHED_PROCESSING?
  3. Set Irp->IoStatus.Status = STATUS_SHARING_VIOLATION and cancel the file open using FltCancelFileOpen and then return FLT_POSTOP_FINISHED_PROCESSING?

Please advice.

Thanks.
-Prasad


NTFSD is sponsored by OSR

OSR is hiring!! Info at http://www.osr.com/careers

For our schedule of debugging and file system seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer