Hi,
Is is safe to detach and delete filter device in FastIoDetachDevice()
routine?
I mean, does the I/O Manager ensure before calling this routine that there
is no
I/O currently pending for that device and does it reject further I/O
requests?
Or I need to keep track of outstanding I/O requests in my filter device
attached
to the logical volume and wait in FastIoDetachDevice() until they all will
be completed
before safely detach and delete filter device? Is it necessary in this case
to take into
account fast I/O operations?
Thanks in advance for any help,
Leonid.
In Windows XP it is safe. In Windows 2000 and earlier you must maintain a
reference count (this was covered some time ago in an NT Insider article I
wrote). Specifically, FAT would delete its device object while processing
an IRP (close, I think) which would then cause you to be called at your fast
I/O detach device entry point. If you deleted it at that point, when your
completion routine was called (and passed a pointer to your now deleted
device object) it would blow up.
We used to see this problem with removable media devices. We resolved this
by maintaining a reference count in our device extension - the attach was
one reference, each IRP was another. Decrementing it in the completion
routine of the IRP and deleting it when it went to zero fixed/resolved the
problem.
This is one of the reasons there is now IoSetCompletionRoutineEx (which adds
a reference count if you have a completion routine) in Windows XP.
Regards,
Tony
Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com
-----Original Message-----
From: Leonid Zhigunov [mailto:xxxxx@progate.spb.ru]
Sent: Friday, May 17, 2002 5:20 AM
To: File Systems Developers
Subject: [ntfsd] FastIoDetachDevice
Hi,
Is is safe to detach and delete filter device in FastIoDetachDevice()
routine?
I mean, does the I/O Manager ensure before calling this routine that there
is no
I/O currently pending for that device and does it reject further I/O
requests?
Or I need to keep track of outstanding I/O requests in my filter device
attached
to the logical volume and wait in FastIoDetachDevice() until they all will
be completed
before safely detach and delete filter device? Is it necessary in this case
to take into
account fast I/O operations?
Thanks in advance for any help,
Leonid.
You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to %%email.unsub%%
Yes. This is precisely why the call is there.
Jamey Kirby
StorageCraft, inc.
xxxxx@storagecraft.com
www.storagecraft.com
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Leonid Zhigunov
Sent: Friday, May 17, 2002 2:20 AM
To: File Systems Developers
Subject: [ntfsd] FastIoDetachDevice
Hi,
Is is safe to detach and delete filter device in FastIoDetachDevice()
routine?
I mean, does the I/O Manager ensure before calling this routine that
there
is no
I/O currently pending for that device and does it reject further I/O
requests?
Or I need to keep track of outstanding I/O requests in my filter device
attached
to the logical volume and wait in FastIoDetachDevice() until they all
will
be completed
before safely detach and delete filter device? Is it necessary in this
case
to take into
account fast I/O operations?
Thanks in advance for any help,
Leonid.
You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
To unsubscribe send a blank email to %%email.unsub%%
> Is is safe to detach and delete filter device in FastIoDetachDevice()
routine?
Exactly so, the only safe place for non-PnP stacks like filesystems.
I mean, does the I/O Manager ensure before calling this routine that there
is no
I/O currently pending for that device and does it reject further I/O
requests?
FastIoDetachDevice is called only from the lower driver’s IoDeleteDevice.
So, if the lower driver is correct, your filter will be correct too.
For PnP stacks, do not use FastIoDetachDevice and process REMOVE IRP instead, do this the way the documentation and Toaster sample
does.
Max