Post-operation at PASSIVE_LEVEL

Hi,
I’m searching for solution of how to under any circumstances get code to run
at PASSIVE_LEVEL in post-operation for IRP_MJ_SET_INFORMATION.

In pre-operation for IRP_MJ_SET_INFORMATION I do some processing at
PASSIVE_LEVEL which require cleanup in post-operation but also this cleanup
must run at PASSIVE_LEVEL.
As I mentioned in my previous post I’m synchronizing pre-op and post-op
using FLT_PREOP_SYNCHRONIZE and I know that pre-operation is running at
PASSIVE_LEVEL (I do not filter paging path).

  1. Is post-operation running at PASSIVE_LEVEL too in this situation? I
    really need PASSIVE_LEVEL not APC_LEVEL (in documentation I can read that
    post-op is running at IRQL <= APC_LEVEL).

  2. If not, what to do when I got FLTFL_POST_OPERATION_DRAINING on
    post-operation and i cannot pend processing into system worker queue using
    FltQueueDeferredIoWorkItem. There is some function FltQueueGenericWorkItem
    which could maybe solve my problem but still there is problem if allocation
    for this function fail.

Thanks for your clues on how

Jan Milan

I use FltQueueGenericWorkItem in my post-SetInfo callback with no problem.

FltAllocateGenericWorkItem can fail due to low memory, but if that’s an
issue allocate it in the pre-callback and pass it in the context. If the
allocation fails in the pre-callback, abort the whole IRP_MJ_SET_INFORMATION
operation.

Ken

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jan Milan
Sent: Thursday, January 04, 2007 7:25 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] Post-operation at PASSIVE_LEVEL

Hi,
I’m searching for solution of how to under any circumstances get code to run
at PASSIVE_LEVEL in post-operation for IRP_MJ_SET_INFORMATION.

In pre-operation for IRP_MJ_SET_INFORMATION I do some processing at
PASSIVE_LEVEL which require cleanup in post-operation but also this cleanup
must run at PASSIVE_LEVEL.
As I mentioned in my previous post I’m synchronizing pre-op and post-op
using FLT_PREOP_SYNCHRONIZE and I know that pre-operation is running at
PASSIVE_LEVEL (I do not filter paging path).

  1. Is post-operation running at PASSIVE_LEVEL too in this situation? I
    really need PASSIVE_LEVEL not APC_LEVEL (in documentation I can read that
    post-op is running at IRQL <= APC_LEVEL).

  2. If not, what to do when I got FLTFL_POST_OPERATION_DRAINING on
    post-operation and i cannot pend processing into system worker queue using
    FltQueueDeferredIoWorkItem. There is some function FltQueueGenericWorkItem
    which could maybe solve my problem but still there is problem if allocation
    for this function fail.

Thanks for your clues on how

Jan Milan


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@comcast.net
To unsubscribe send a blank email to xxxxx@lists.osr.com

Just return FLT_PREOP_SYNCHRONIZE and you will be happy.

MiniFilter-Scanner-sample does the same, because it calls
“FltGetFileNameInformation” in Post-Operation.

FLT_PREOP_SYNCHRONIZE should be used with care because it requires Filter
Manager to synchronizes the entire I/O and this has negative performance
impacts on the systems overall throughput.

Google for “FilterDriverDeveloperGuide.doc” to get more info about it.

“Jan Milan” schrieb im Newsbeitrag
news:xxxxx@ntfsd…
> Hi,
> I’m searching for solution of how to under any circumstances get code to
> run
> at PASSIVE_LEVEL in post-operation for IRP_MJ_SET_INFORMATION.
>
> In pre-operation for IRP_MJ_SET_INFORMATION I do some processing at
> PASSIVE_LEVEL which require cleanup in post-operation but also this
> cleanup
> must run at PASSIVE_LEVEL.
> As I mentioned in my previous post I’m synchronizing pre-op and post-op
> using FLT_PREOP_SYNCHRONIZE and I know that pre-operation is running at
> PASSIVE_LEVEL (I do not filter paging path).
>
> 1. Is post-operation running at PASSIVE_LEVEL too in this situation? I
> really need PASSIVE_LEVEL not APC_LEVEL (in documentation I can read that
> post-op is running at IRQL <= APC_LEVEL).
>
> 2. If not, what to do when I got FLTFL_POST_OPERATION_DRAINING on
> post-operation and i cannot pend processing into system worker queue using
> FltQueueDeferredIoWorkItem. There is some function FltQueueGenericWorkItem
> which could maybe solve my problem but still there is problem if
> allocation
> for this function fail.
>
> Thanks for your clues on how
>
> Jan Milan
>
>
>

Hi,

I’m still not happy besauce Minifilter-Scanner-sample uses
FltGetFileInformation in post-CREATE operation which is OK since post-CREATE
is always called at PASSIVE_LEVEL.

There is no more written in FilterDriverDeveloperGuide.doc about it than in
WDK doc.

  1. Post-operation could run at APC_LEVEL because it is executed as a special
    kernel APC?
  2. Why all my post-setinfo operations runs at PASSIVE_LEVEL then?

Sorry. I meant the Ctx-Sample. It’s in
IRP_MJ_SET_INFORMATION/CtxPreSetInfo/CtxPostSetInfo

Why can’t you deal with APC_LEVEL?

“Jan Milan” schrieb im Newsbeitrag
news:xxxxx@ntfsd…
> Hi,
>
> I’m still not happy besauce Minifilter-Scanner-sample uses
> FltGetFileInformation in post-CREATE operation which is OK since
> post-CREATE
> is always called at PASSIVE_LEVEL.
>
> There is no more written in FilterDriverDeveloperGuide.doc about it than
> in
> WDK doc.
>
> 1. Post-operation could run at APC_LEVEL because it is executed as a
> special
> kernel APC?
> 2. Why all my post-setinfo operations runs at PASSIVE_LEVEL then?
>
>
>

Hi,
I have finally found answer to my question in one of forum thread
(STATUS_NOT_SUPPORTED in FltSetStreamHandleContext) where Neal Christiansen
wrote:


30 Nov 04 18:36 , Neal Christiansen [MSFT]
Ken,

If you have operations that require you to be at passive level then what
you are doing is correct. We have had this request before and we are
looking at fixing this API so you can specify if you need to be at
passive level vs APC level to do your required work.

Neal Christiansen
Microsoft File System Filter Group Lead
This posting is provided “AS IS” with no warranties, and confers no
rights

As it looks that FltDoCompletionWhenSafe (the API which is Neal talking
about in his post) still has no option for specify if I need to be at
passive level, I need to pend post-operation into worker thread to assure
that. And best solution is to pend it only if running at APC level.

Thanks to Ken for idea to allocate memory in pre-operation.

“Jan Milan” wrote in message news:xxxxx@ntfsd…
> Hi,
> I’m searching for solution of how to under any circumstances get code to
run
> at PASSIVE_LEVEL in post-operation for IRP_MJ_SET_INFORMATION.
>
> In pre-operation for IRP_MJ_SET_INFORMATION I do some processing at
> PASSIVE_LEVEL which require cleanup in post-operation but also this
cleanup
> must run at PASSIVE_LEVEL.
> As I mentioned in my previous post I’m synchronizing pre-op and post-op
> using FLT_PREOP_SYNCHRONIZE and I know that pre-operation is running at
> PASSIVE_LEVEL (I do not filter paging path).
>
> 1. Is post-operation running at PASSIVE_LEVEL too in this situation? I
> really need PASSIVE_LEVEL not APC_LEVEL (in documentation I can read that
> post-op is running at IRQL <= APC_LEVEL).
>
> 2. If not, what to do when I got FLTFL_POST_OPERATION_DRAINING on
> post-operation and i cannot pend processing into system worker queue using
> FltQueueDeferredIoWorkItem. There is some function FltQueueGenericWorkItem
> which could maybe solve my problem but still there is problem if
allocation
> for this function fail.
>
> Thanks for your clues on how
>
> Jan Milan
>
>
>

If the pre-operation callback came in as passive level and you return
FLT_PREOP_SYNCHRONIZE the post-operation callback is guaranteed to be at
passive level since internally we are synchronizing back to that same
thread.

Returning FLT_PREOP_SYNCHRONIZE is only a PERF issue for read/write
operations which are marked asynchronous. I have not seen a perf issue
synchronizing any other operations.

Neal Christiansen
Microsoft NTFS Development Lead
This posting is provided “AS IS” with no warranties, and confers no
Rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jan Milan
Sent: Friday, January 05, 2007 7:29 AM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] Post-operation at PASSIVE_LEVEL

Hi,
I have finally found answer to my question in one of forum thread
(STATUS_NOT_SUPPORTED in FltSetStreamHandleContext) where Neal
Christiansen
wrote:


30 Nov 04 18:36 , Neal Christiansen [MSFT]
Ken,

If you have operations that require you to be at passive level then what
you are doing is correct. We have had this request before and we are
looking at fixing this API so you can specify if you need to be at
passive level vs APC level to do your required work.

Neal Christiansen
Microsoft File System Filter Group Lead
This posting is provided “AS IS” with no warranties, and confers no
rights

As it looks that FltDoCompletionWhenSafe (the API which is Neal talking
about in his post) still has no option for specify if I need to be at
passive level, I need to pend post-operation into worker thread to
assure
that. And best solution is to pend it only if running at APC level.

Thanks to Ken for idea to allocate memory in pre-operation.

“Jan Milan” wrote in message news:xxxxx@ntfsd…
> Hi,
> I’m searching for solution of how to under any circumstances get code
to
run
> at PASSIVE_LEVEL in post-operation for IRP_MJ_SET_INFORMATION.
>
> In pre-operation for IRP_MJ_SET_INFORMATION I do some processing at
> PASSIVE_LEVEL which require cleanup in post-operation but also this
cleanup
> must run at PASSIVE_LEVEL.
> As I mentioned in my previous post I’m synchronizing pre-op and
post-op
> using FLT_PREOP_SYNCHRONIZE and I know that pre-operation is running
at
> PASSIVE_LEVEL (I do not filter paging path).
>
> 1. Is post-operation running at PASSIVE_LEVEL too in this situation? I
> really need PASSIVE_LEVEL not APC_LEVEL (in documentation I can read
that
> post-op is running at IRQL <= APC_LEVEL).
>
> 2. If not, what to do when I got FLTFL_POST_OPERATION_DRAINING on
> post-operation and i cannot pend processing into system worker queue
using
> FltQueueDeferredIoWorkItem. There is some function
FltQueueGenericWorkItem
> which could maybe solve my problem but still there is problem if
allocation
> for this function fail.
>
> Thanks for your clues on how
>
> Jan Milan
>
>
>


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com