Hang in PostCleanup Operation when Deleting a file

Hi Folks,
I am getting a hang in my minifilter when I try to Delete a file in the PostCleanup. The hang occurs as the thread is waiting for an oplock.
From the dump the oplock is shared RH .
So I was think of ways I need to handle the deletion for the file.
1.Post it to the Worker thread and purge the File cache, so that oplocks on the file are gone.
2.Wait of Oplock break notify to start deletion of the file .

Any inputs on the pros and cons of these approaches ?

Regards,
Mehtab
@Symantec

Why did you choose PostCleanup and how are you trying to delete the file? If you’re sending a SetDisposition on the cleaned up File Object then you’re pretty much doomed.

We monitor file copy scenarios. We need to read the file content of the file and check if it contains data of interest. So cleanup provides a place to analyze and delete the file in the PostCleanup.
Yes we are using SetDisposition , however we are rolling our own create on the file to delete the file. If that fails we try DeleteOnClose.

Regards,
Mehtab
@Symantec

Are you opening in the PostCleanup callback or doing it in a worker thread? Also, who owns the oplock when you’re stuck? !fltmgr.oplock should tell you.