Hello,
Could someone explain why and when to call these functions from
within a file system filter. An example or two to illustrate the why’s
would be helpful.
Thanks,
Joel
Hello,
Could someone explain why and when to call these functions from
within a file system filter. An example or two to illustrate the why’s
would be helpful.
Thanks,
Joel
Use these any time you wish to block kernel APCs. Specifically, any time
you are using synchronization mechanisms that cannot tolerate arbitrarily
reentrant behavior. This is the case for ERESOURCE locks, for example,
which should only be held when you have disabled reentrancy (normally. The
one exception is if you only have ONE ERESOURCE for your entire driver, in
which case you have no lock hierarchy issues with which you must contend.)
The same thing applies to a filter driver.
Note: FsRtlEnterFileSystem does not block special kernel APCs. This is VERY
IMPORTANT because raising to APC_LEVEL disables special kernel APCs. What
that means is that you cannot block awaiting the completion of I/O. The
normal sequence here is:
status = IoCallDriver(DeviceObject, Irp);
if (STATUS_PENDING == status) {
KeWaitForSingleObject(Irp->Event,…);
}
If you do this at APC_LEVEL it may not function correctly (because it is an
APC that signals the event, but since the APC cannot run, the event cannot
be signaled and the wait is never satisfied. It makes the I/O look as if it
has “hung”.) “May not” because it will depend upon the precise details of
how this was implemented.
I mention this last point because I’ve seen people try to utilize “fast
mutexes” but these have the side effect of disabling APCs. A bit off-topic,
perhaps.
I hope this helps.
Regards,
Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com http:
-----Original Message-----
From: Smith, Joel [mailto:xxxxx@ntpsoftware.com]
Sent: Tuesday, June 13, 2000 3:02 PM
To: File Systems Developers
Subject: [ntfsd] FsRtlEnterFileSystem/FsRtlExitFileSystem
Hello,
Could someone explain why and when to call these functions from
within a file system filter. An example or two to illustrate the why’s
would be helpful.
Thanks,
Joel</http:>
FsRtlEnterFileSystem/FsRtlExitFileSystem>Subject: [ntfsd]
FsRtlEnterFileSystem/FsRtlExitFileSystem
Synonims for KeEnter/LeaveCriticalRegion.
Enter before acquiring any resources, leave after releasing all of them.
Max
Thw sfilter example in the W2k IFSKit shows proper usage of this call.
-----Original Message-----
From: Smith, Joel [mailto:xxxxx@ntpsoftware.com]
Sent: Tuesday, June 13, 2000 12:02 PM
To: File Systems Developers
Subject: [ntfsd] FsRtlEnterFileSystem/FsRtlExitFileSystem
Hello,
Could someone explain why and when to call these functions from
within a file system filter. An example or two to illustrate the why’s
would be helpful.
Thanks,
Joel