Thanks Anton!
I am implementing a minifilter.
The documentation for FltPerformAsynchronousIo says :
“The caller of FltPerformAsynchronousIo can be running at IRQL <= APC_LEVEL
if the IRP_PAGING_IO flag is set in the IrpFlags member of the
FLT_IO_PARAMETER_BLOCK structure for the operation. (This flag is only valid
for IRP_MJ_READ, IRP_MJ_WRITE, IRP_MJ_QUERY_INFORMATION, and
IRP_MJ_SET_INFORMATION operations.) Otherwise, the caller must be running at
IRQL PASSIVE_LEVEL.”
This means that we can use this function in the paging i/o path also.
However, the documentation for FltAllocateCallbackdata just says that it can
be used when IRQL <=APC_LEVEL and does not say anything in particular for
paging i/o.
Since, FltPerformASynchronousIo can be used, it can be assumed that
FltAllocateCallbackdata should also work.
So in this situation, are the following operations legal:
PreWrite() {
FltAllocateCallbackdata()
FltPerformAsynchronousIo(…,CallbackRoutine,…)
KeWaitForSingleObject(event,INFINITE TIME);
}
Callback(){
KeSetEvent(event);
}
Will the above work?
Any special conditions that i should look out for?
----- Original Message -----
From:
To: “Windows File Systems Devs Interest List”
Sent: Monday, July 23, 2007 10:19 AM
Subject: RE:[ntfsd] FltAllocateCallbackdata etc. in paging I/O Path
> First of all, ask yourself a question why you cannot use FltWriteFile()
> and friends while processing paging IO, and, at this point, you will
> realize what can and what cannot be done here…
>
> When you process paging IO (IRP_PAGING_IO flag is set) and
> FsRtlIsPagingFile() returns false, although you can take page faults on
> data, you cannot take them on code, for understandable reasons -
> otherwise, you will get into an infinite recursion. When you process
> paging IO and FsRtlIsPagingFile() returns true (i.e. the target file is
> paging one), you cannot page fault on either code or data, for obvious
> reasons. All functions that you have mentioned are callable only at
> IRQL< DISPATCH_LEVEL, which means they potentially may page-fault even on
> code, and, hence, cannot be used while processing paging IO.
>
> At this point the solution becomes obvious - once you cannot cause page
> faults at IRQL>=DISPATCH_LEVEL, you should use only those functions that
> are callable at elevated IRQL while processing paging IO. Fltxxx and Zwxxx
> functions, as well as IoBuildDeviceIoControlRequest() and
> IoBuildAsynchronousFsdRequest(), are not among them. Therefore, the only
> option left is IoAllocateIrp()-IoCallDriver() sequence…
>
> Anton Bassov
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@yahoo.co.in
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>