Dismounting Logical Volume

Hi.

I have a logical volume device that I create in my
otherwise-normal storage filter driver in response to
user requests. By simply creating the named device
object and creating a Win32 link to it with
DefineDosDevice, I can get NTFS to successfully mount
my logical volume, and everything seems to go well.

What I can’t seem to do is determine how to get NTFS
to dismount the volume when I want to delete the
logical volume. Currently when I want the logical
volume device to go away, I do the following:

  1. Delete the Win32 symbolic link using
    DefineDosDevice(DDD_REMOVE_DEFINITION,…)
  2. Set a flag that causes all subsequent requests
    directed at the logical volume device to fail with
    STATUS_NO_SUCH_DEVICE.
  3. Wait for all active/pending operations to
    complete.
  4. call IoDeleteDevice.

It appears as if all of my cleanup is going OK, but I
have no way (or don’t know the way) to ask NTFS to
dismount. Can anyone offer suggestions?

Thanks.

Myk Willis

>It appears as if all of my cleanup is going OK, but I

have no way (or don’t know the way) to ask NTFS to
dismount. Can anyone offer suggestions?

Call IoDeviceControl with FSCTL_DISMOUNT_VOLUME.

Alexei.

You need to send the following sequence to the FSD on the volume:

  • Lock
  • Dismount
  • Unlock

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Myk Willis
Sent: Tuesday, April 29, 2003 6:42 AM
To: File Systems Developers
Subject: [ntfsd] Dismounting Logical Volume

Hi.

I have a logical volume device that I create in my
otherwise-normal storage filter driver in response to
user requests. By simply creating the named device
object and creating a Win32 link to it with
DefineDosDevice, I can get NTFS to successfully mount
my logical volume, and everything seems to go well.

What I can’t seem to do is determine how to get NTFS
to dismount the volume when I want to delete the
logical volume. Currently when I want the logical
volume device to go away, I do the following:

  1. Delete the Win32 symbolic link using
    DefineDosDevice(DDD_REMOVE_DEFINITION,…)
  2. Set a flag that causes all subsequent requests
    directed at the logical volume device to fail with
    STATUS_NO_SUCH_DEVICE.
  3. Wait for all active/pending operations to
    complete.
  4. call IoDeleteDevice.

It appears as if all of my cleanup is going OK, but I
have no way (or don’t know the way) to ask NTFS to
dismount. Can anyone offer suggestions?

Thanks.

Myk Willis


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

> I have a logical volume device that I create in my

otherwise-normal storage filter driver in response to
user requests. By simply creating the named device
object and creating a Win32 link to it with
DefineDosDevice, I can get NTFS to successfully mount
my logical volume, and everything seems to go well.

On NT4, this scheme caused some very nasty BSODs with
DEVICE_REFERENCE_COUNT_NOT_ZERO. So, we ended with immortal device
object which is created together with the filter DO and is never
deleted.

Max

> Call IoDeviceControl with FSCTL_DISMOUNT_VOLUME.

More correct way is to send a sequence of LOCK/DISMOUNT/UNLOCK FSCTLs.

Max

Thanks to James, Alexei, and Max. All’s working well
now.

Myk
— Jamey Kirby wrote:
> You need to send the following sequence to the FSD
> on the volume:
> - Lock
> - Dismount
> - Unlock
>
> Jamey
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf
> Of Myk Willis
> Sent: Tuesday, April 29, 2003 6:42 AM
> To: File Systems Developers
> Subject: [ntfsd] Dismounting Logical Volume
>
> Hi.
>
> I have a logical volume device that I create in my
> otherwise-normal storage filter driver in response
> to
> user requests. By simply creating the named device
> object and creating a Win32 link to it with
> DefineDosDevice, I can get NTFS to successfully
> mount
> my logical volume, and everything seems to go well.
>
> What I can’t seem to do is determine how to get NTFS
> to dismount the volume when I want to delete the
> logical volume. Currently when I want the logical
> volume device to go away, I do the following:
>
> 1. Delete the Win32 symbolic link using
> DefineDosDevice(DDD_REMOVE_DEFINITION,…)
> 2. Set a flag that causes all subsequent requests
> directed at the logical volume device to fail with
> STATUS_NO_SUCH_DEVICE.
> 3. Wait for all active/pending operations to
> complete.
> 4. call IoDeleteDevice.
>
> It appears as if all of my cleanup is going OK, but
> I
> have no way (or don’t know the way) to ask NTFS to
> dismount. Can anyone offer suggestions?
>
> Thanks.
>
> Myk Willis
>
>
> —
> You are currently subscribed to ntfsd as:
> xxxxx@storagecraft.com
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
>
>
> —
> You are currently subscribed to ntfsd as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
xxxxx@lists.osr.com