Re[2]: Sfilter & mount on w2k

Molly,

thank you for clarification.

Assume we’re on Windows 2000. Since SfIsAttachedToDevice() is called
from a worker thread, thus outside of mount processing, can we be sure
that the device stack won’t be torn down while we’re walking it?

Thanks.

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

Thursday, October 14, 2004, 12:35:12 AM, you wrote:

MB> Hi Jiri,

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

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

MB> Thanks,
MB> Molly Brown
MB> Microsoft Corporation

MB> This posting is provided “AS IS” with no warranties and confers no
MB> rights.

MB> -----Original Message-----
MB> From: xxxxx@lists.osr.com
MB> [mailto:xxxxx@lists.osr.com] On Behalf Of Jiri Bracek
MB> Sent: Wednesday, October 13, 2004 4:42 AM
MB> To: Windows File Systems Devs Interest List
MB> Subject: [ntfsd] Sfilter & mount on w2k

MB> Hello all,

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

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

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

MB> Thank you.
MB> –
MB> Jiri Bracek
MB> GRISOFT, s.r.o.
MB> mailto:xxxxx@grisoft.cz

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

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

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

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

Even though the final mount processing for your filter is handled by a
worker thread, the MOUNT request itself has not yet been completed. The
stack cannot be torn down until the mount processing is completed, so
you can safely walk the device stack at this point in time.

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: Thursday, October 14, 2004 5:28 AM
To: Windows File Systems Devs Interest List
Subject: Re[2]: [ntfsd] Sfilter & mount on w2k

Molly,

thank you for clarification.

Assume we’re on Windows 2000. Since SfIsAttachedToDevice() is called
from a worker thread, thus outside of mount processing, can we be sure
that the device stack won’t be torn down while we’re walking it?

Thanks.

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

Thursday, October 14, 2004, 12:35:12 AM, you wrote:

MB> Hi Jiri,

MB> No, the problem is not that mount requests get completed at DPC on
MB> Windows 2000. The problem is that DFS filter on Windows 2000 Server

MB> calls down to the file system with APCs disabled (it is inside a
MB> call to FsRtlEnterFileSystem()). If your filter waits in the
MB> dispatch routine for the MOUNT IRP to complete, APCs will still be
MB> disabled when FAT wants to do is final processing which completes
MB> the IRP. FAT needs to queue an APC to do this final processing, but

MB> since APCs are disabled, this APC will never run, the IRP will never

MB> be completed and your filter’s event will never be signaled.

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

MB> can do this final mount process at PASSIVE_LEVEL is not very large
MB> and MOUNTs do not happen very frequently.

MB> Thanks,
MB> Molly Brown
MB> Microsoft Corporation

MB> This posting is provided “AS IS” with no warranties and confers no
MB> rights.

MB> -----Original Message-----
MB> From: xxxxx@lists.osr.com
MB> [mailto:xxxxx@lists.osr.com] On Behalf Of Jiri Bracek
MB> Sent: Wednesday, October 13, 2004 4:42 AM
MB> To: Windows File Systems Devs Interest List
MB> Subject: [ntfsd] Sfilter & mount on w2k

MB> Hello all,

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

MB> //
MB> // VERSION NOTE:
MB> //
MB> // On Windows 2000, we cannot simply synchronize back to the
MB> dispatch
MB> // routine to do our post-mount processing. We need to do this

MB> work at
MB> // passive level, so we will queue that work to a worker thread

MB> from
MB> // the completion routine.
MB> //
MB> // For Windows XP and later, we can safely synchronize back to
MB> the dispatch
MB> // routine. The code below shows both methods. Admittedly,
MB> the code
MB> // would be simplified if you chose to only use one method or
MB> the other,
MB> // but you should be able to easily adapt this for your needs.
MB> //

MB> It makes me think that it is possible for a mount request to come to

MB> the filter at DISPATCH_LEVEL on Windows 2000. Is it true? In what
MB> circumstances does it happen?

MB> Thank you.
MB> –
MB> Jiri Bracek
MB> GRISOFT, s.r.o.
MB> mailto:xxxxx@grisoft.cz

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

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

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

MB> You are currently subscribed to ntfsd as: unknown lmsubst tag
argument: ‘’
MB> 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: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

As long as you are in the processing path of the IRP and you do not get a
cancel request, regardless of the process context or if the request has been
queued, the device stack will not go away; not without you getting some sort
of notification first.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jiri Bracek
Sent: Thursday, October 14, 2004 5:28 AM
To: Windows File Systems Devs Interest List
Subject: Re[2]: [ntfsd] Sfilter & mount on w2k

Molly,

thank you for clarification.

Assume we’re on Windows 2000. Since SfIsAttachedToDevice() is called
from a worker thread, thus outside of mount processing, can we be sure
that the device stack won’t be torn down while we’re walking it?

Thanks.

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

Thursday, October 14, 2004, 12:35:12 AM, you wrote:

MB> Hi Jiri,

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

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

MB> Thanks,
MB> Molly Brown
MB> Microsoft Corporation

MB> This posting is provided “AS IS” with no warranties and confers no
MB> rights.

MB> -----Original Message-----
MB> From: xxxxx@lists.osr.com
MB> [mailto:xxxxx@lists.osr.com] On Behalf Of Jiri Bracek
MB> Sent: Wednesday, October 13, 2004 4:42 AM
MB> To: Windows File Systems Devs Interest List
MB> Subject: [ntfsd] Sfilter & mount on w2k

MB> Hello all,

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

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

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

MB> Thank you.
MB> –
MB> Jiri Bracek
MB> GRISOFT, s.r.o.
MB> mailto:xxxxx@grisoft.cz

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

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

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

MB> You are currently subscribed to ntfsd as: unknown lmsubst tag argument:
‘’
MB> To unsubscribe send a blank email to
MB> 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: xxxxx@storagecraft.com
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