USB Drive letter remains after doing surprise removal

Hi

i am developing my own cutomized file system driver on windows based on fast fat architecture.
Problem is that on Windows 7 when we read/write any file (e.g movie file etc) and if suddenly surprise removal is done then sometimes Drive letter doesnt disappear and OS behaves abnormally afterwards, Now OS will not recognize any usb stick(not even fastfat) and when i tried to do shutdown , its taking lot of time. This problem is intermittent , not 100% everytime.?? am i doing something wrong with cache initialization.

U must check out That u are cleaning your VCb properly whenever it is deatched.
If VCB which is Nonpaged memory doesnt get clean , it might create problems.

Shutdown thing is happened if either any of your thread keep running or waitiong fr some object…

just check locjka also…

Pls bear with my English as it is not my nativi language

check this one out …while going for shutdown how ext2 do the job…

rp = IrpContext->Irp;
IrpSp = IoGetCurrentIrpStackLocation(Irp);

if (!ExAcquireResourceExclusiveLite(
&Ext2Global->Resource,
IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT) )) {
Status = STATUS_PENDING;
__leave;
}

ext2 uses fat base only…just check in case if your status is pending, if yes then there is sync problem with locks whioch is causing problem with OS.