Sfilter & mount on w2k

Hello all,

there is a comment in function SfFsControlMountVolume() in sfilter
sample from WS2003 SP1 IFS kit:

//
// VERSION NOTE:
//
// On Windows 2000, we cannot simply synchronize back to the dispatch
// routine to do our post-mount processing. We need to do this work at
// passive level, so we will queue that work to a worker thread from
// the completion routine.
//
// For Windows XP and later, we can safely synchronize back to the dispatch
// routine. The code below shows both methods. Admittedly, the code
// would be simplified if you chose to only use one method or the other,
// but you should be able to easily adapt this for your needs.
//

It makes me think that it is possible for a mount request to come to
the filter at DISPATCH_LEVEL on Windows 2000. Is it true? In what
circumstances does it happen?

Thank you.

Jiri Bracek
GRISOFT, s.r.o.
mailto:xxxxx@grisoft.cz

Hi Jiri,

No, the problem is not that mount requests get completed at DPC on
Windows 2000. The problem is that DFS filter on Windows 2000 Server
calls down to the file system with APCs disabled (it is inside a call to
FsRtlEnterFileSystem()). If your filter waits in the dispatch routine
for the MOUNT IRP to complete, APCs will still be disabled when FAT
wants to do is final processing which completes the IRP. FAT needs to
queue an APC to do this final processing, but since APCs are disabled,
this APC will never run, the IRP will never be completed and your
filter’s event will never be signaled.

Now, you may ask “Why not just do this work in the mount completion
routine since a mount request isn’t going to get completed at DPC?”.
While to date I’ve never seen a mount request complete at DPC, but the
IO model does not rule out that possibility, so my advice is to error on
the side of caution. The extra overhead to ensure that you can do this
final mount process at PASSIVE_LEVEL is not very large and MOUNTs do not
happen very frequently.

Thanks,
Molly Brown
Microsoft Corporation

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 Jiri Bracek
Sent: Wednesday, October 13, 2004 4:42 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] Sfilter & mount on w2k

Hello all,

there is a comment in function SfFsControlMountVolume() in sfilter
sample from WS2003 SP1 IFS kit:

//
// VERSION NOTE:
//
// On Windows 2000, we cannot simply synchronize back to the
dispatch
// routine to do our post-mount processing. We need to do this
work at
// passive level, so we will queue that work to a worker thread
from
// the completion routine.
//
// For Windows XP and later, we can safely synchronize back to the
dispatch
// routine. The code below shows both methods. Admittedly, the
code
// would be simplified if you chose to only use one method or the
other,
// but you should be able to easily adapt this for your needs.
//

It makes me think that it is possible for a mount request to come to the
filter at DISPATCH_LEVEL on Windows 2000. Is it true? In what
circumstances does it happen?

Thank you.

Jiri Bracek
GRISOFT, s.r.o.
mailto:xxxxx@grisoft.cz


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

Thanks Molly for pointing this out. It is something we do not account for in
our drivers and we should. We have a few drivers out there that have been
having some weird deadlocks in the mount processing. With millions of
drivers out there, I have only seen it in maybe 20 cases. This may be the
solution. Each case there is DFS and several other filters loaded; making
for some complex mount filtering and processing.

I think these needs to be put into the FAQ.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Molly Brown
Sent: Wednesday, October 13, 2004 3:35 PM
To: Windows File Systems Devs Interest List
Subject: RE: [ntfsd] Sfilter & mount on w2k

Hi Jiri,

No, the problem is not that mount requests get completed at DPC on
Windows 2000. The problem is that DFS filter on Windows 2000 Server
calls down to the file system with APCs disabled (it is inside a call to
FsRtlEnterFileSystem()). If your filter waits in the dispatch routine
for the MOUNT IRP to complete, APCs will still be disabled when FAT
wants to do is final processing which completes the IRP. FAT needs to
queue an APC to do this final processing, but since APCs are disabled,
this APC will never run, the IRP will never be completed and your
filter’s event will never be signaled.

Now, you may ask “Why not just do this work in the mount completion
routine since a mount request isn’t going to get completed at DPC?”.
While to date I’ve never seen a mount request complete at DPC, but the
IO model does not rule out that possibility, so my advice is to error on
the side of caution. The extra overhead to ensure that you can do this
final mount process at PASSIVE_LEVEL is not very large and MOUNTs do not
happen very frequently.

Thanks,
Molly Brown
Microsoft Corporation

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 Jiri Bracek
Sent: Wednesday, October 13, 2004 4:42 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] Sfilter & mount on w2k

Hello all,

there is a comment in function SfFsControlMountVolume() in sfilter
sample from WS2003 SP1 IFS kit:

//
// VERSION NOTE:
//
// On Windows 2000, we cannot simply synchronize back to the
dispatch
// routine to do our post-mount processing. We need to do this
work at
// passive level, so we will queue that work to a worker thread
from
// the completion routine.
//
// For Windows XP and later, we can safely synchronize back to the
dispatch
// routine. The code below shows both methods. Admittedly, the
code
// would be simplified if you chose to only use one method or the
other,
// but you should be able to easily adapt this for your needs.
//

It makes me think that it is possible for a mount request to come to the
filter at DISPATCH_LEVEL on Windows 2000. Is it true? In what
circumstances does it happen?

Thank you.

Jiri Bracek
GRISOFT, s.r.o.
mailto:xxxxx@grisoft.cz


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


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

You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

__________ NOD32 1.860 (20040903) Information __________

This message was checked by NOD32 antivirus system.
http://www.nod32.com