Mount/Dismount in mini-filter

Hi,

There is a wrong behavior in IRP_MJ_VOLUME_MOUNT/IRP_MJ_VOLUME_DISMOUNT
callback operations.

(1) In Post VolumeMount operation ‘FLTFL_CALLBACK_DATA_POST_OPERATION’ flag
is never set. This flag is always set for any other post-operations
including FastIO based.

(2) Although registration is properly done i don´t receive Pre
VolumeDismount callbacks, only instance teardown callbacks.

I have latest filter manager from beta place (build 5.2.3790.1162). Target
machine is Windows Server 2003 free build with checked filter manager.

Thanks in advance.

mK.


Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail

Misha,

I’ll take a look why the ‘FLTFL_CALLBACK_DATA_POST_OPERATION’ flag is not
set in the post VolumeMount callback.This should be set and if not we’ll fix
it. Regarding the volume dismount callbacks we do not notify the filter
driver. Why do you care about the dismount callbacks?

Thanks
Ravinder

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

“Misha Karpin” wrote in message
news:xxxxx@ntfsd…
> Hi,
>
> There is a wrong behavior in IRP_MJ_VOLUME_MOUNT/IRP_MJ_VOLUME_DISMOUNT
> callback operations.
>
> (1) In Post VolumeMount operation ‘FLTFL_CALLBACK_DATA_POST_OPERATION’
flag
> is never set. This flag is always set for any other post-operations
> including FastIO based.
>
> (2) Although registration is properly done i don´t receive Pre
> VolumeDismount callbacks, only instance teardown callbacks.
>
> I have latest filter manager from beta place (build 5.2.3790.1162). Target
> machine is Windows Server 2003 free build with checked filter manager.
>
> Thanks in advance.
>
> mK.
>
> _________________________________________________________________
> Add photos to your e-mail with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail
>
>

Misha,

It was a bug that we were not setting the post operation flag on the post mount callback. Thank you for reporting this, it will be fixed.

The DISMOUNT callback is not currently implemented. It will be implemented some time in the future but it will not happen for the original public release.

The reason this became a lower priority is because you can get this information yourself by monitoring other operations.

Doing this is usually needed if your filter has a file open that needs to be closed. Below is information I prepared on when filters should close their control/log files. This includes when volumes are locked. I have seen several filters do this wrong so I thought I would include all of this information. Though the terminology is for mini-filters this also applies to filters as they are implemented today (what we are calling legacy filters).

If your filter is closing its log file only on instance teardown then this is too late. You need to support the following things:

You need to close your file when a volume is locked. You need to monitor:

FSCTL_LOCK_VOLUME

  • You need to close your log file in the preOperation callback.

  • If you don’t do this your filter will break app
    compatibility especially with backup applications.

  • If the lock request fails you can reopen your file in the postOperation.

  • This is a reasonable operation to synchronize.

  • If the lock request succeeds you need to remember the FILE OBJECT
    that did the lock request (your instance context would be a
    good location for this) and monitor the following 2 operations:

  • FSCTL_UNLOCK_VOLUME

  • This is called if the volume is explicitly unlocked.

  • You can reopen your file in the postOperation callback.

  • IRP_MJ_CLEANUP

  • If you see a cleanup and the file object matches the file
    object that did the lock request, the lock will be
    automatically released.

  • You can reopen the file in your postOperation callback.

To handle dismount you need to monitor the following:

FSCTL_DISMOUNT_VOLUME

  • Close your file during the preOperation callback
  • If the operation failed you can reopen your file
    in the postOperation

IRP_MJ_PNP - IRP_MN_QUERY_REMOVE_DEVICE

  • Close your file during the preOperation callback
  • Note that some file systems dismount the volume while
    processing this request.
  • There is no need to monitor the postOperation callback

IRP_MJ_PNP - IRP_MN_CANCEL_REMOVE_DEVICE

  • The system has decided not to dismount the device.
  • You may reopen your file in the postOperation callback

IRP_MJ_PNP - IRP_MN_SURPRISE_REMOVAL

  • Close your file during the preOperation callback
  • When received the volume is already gone so don’t bother
    trying to write information to your log file because
    it will fail.

IRP_MJ_SHUTDOWN

  • This tells you the system is shutting down
  • Close your file during the preOperation callback
  • You probably will not get a dismount request for the given volume

Neal Christiansen
Microsoft File System Filter Group Lead
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 Ravinder Thind
Sent: Thursday, April 22, 2004 10:29 AM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] Mount/Dismount in mini-filter

Misha,

I’ll take a look why the ‘FLTFL_CALLBACK_DATA_POST_OPERATION’ flag is not
set in the post VolumeMount callback.This should be set and if not we’ll fix
it. Regarding the volume dismount callbacks we do not notify the filter
driver. Why do you care about the dismount callbacks?

Thanks
Ravinder

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

“Misha Karpin” wrote in message
news:xxxxx@ntfsd…
> Hi,
>
> There is a wrong behavior in IRP_MJ_VOLUME_MOUNT/IRP_MJ_VOLUME_DISMOUNT
> callback operations.
>
> (1) In Post VolumeMount operation ‘FLTFL_CALLBACK_DATA_POST_OPERATION’
flag
> is never set. This flag is always set for any other post-operations
> including FastIO based.
>
> (2) Although registration is properly done i don?t receive Pre
> VolumeDismount callbacks, only instance teardown callbacks.
>
> I have latest filter manager from beta place (build 5.2.3790.1162). Target
> machine is Windows Server 2003 free build with checked filter manager.
>
> Thanks in advance.
>
> mK.
>
> _________________________________________________________________
> Add photos to your e-mail with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail
>
>


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

>Misha,

I’ll take a look why the ‘FLTFL_CALLBACK_DATA_POST_OPERATION’ flag is not
set in the post VolumeMount callback.This should be set and if not we’ll
fix it. Regarding the volume dismount callbacks we do not notify the filter
driver. Why do you care about the dismount callbacks?

I don’t really need volume dismount callbacks. I discovered this in my test
samples :slight_smile:
Thanks


MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus