none
Format Disk from NTFS to exFAT fail with Storport Miniport driver. RRS feed

  • Question

  • Hi, All,

    I worked with one STORPORT miniport driver recently and encounter one problem.

       -Fail Phenomenon #1: Format Disk from NTFS to exFAT fail.

       -Fail Phenomenon #2: Use chkdsk tool for NTFS, chkdsk report it is a raw disk.

       -Failure Reproduce steps:

             1) Format Disk with NTFS

             2) Copy some file into this disk

             3) Wait both Disk and Adapter into D3 state

             4) Try to format Disk from NTFS to exFAT or do disk check (Will Fail sometimes) .

       -Find such issue on Win8.1/Win10.

    I capture the Windows_Kernel_Disk event through ETW and find there is one abnormal read event (read 0 bytes from sector address 0) while miniport driver did not get such SRB at all. And there is no such event in good case.

    Does anyone ever meet such kind of issue? or some clue to dig it out?

    Thanks.

    BR,

    Xiangshan

     


    It is the life.

    Friday, November 27, 2015 8:26 AM

All replies

  • Update some findings as below:

    Find below Classpnp driver do not deliver the IRP and just complete it.

    NTSTATUS ClassReadWrite(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
    {
        PCOMMON_DEVICE_EXTENSION commonExtension = DeviceObject->DeviceExtension;
        PDEVICE_OBJECT      lowerDeviceObject = commonExtension->LowerDeviceObject;
        PIO_STACK_LOCATION  currentIrpStack = IoGetCurrentIrpStackLocation(Irp);
        ULONG               transferByteCount = currentIrpStack->Parameters.Read.Length;
        ULONG               isRemoved;
        NTSTATUS            status;
    
        /*
         *  Grab the remove lock.  If we can't acquire it, bail out.
         */
        isRemoved = ClassAcquireRemoveLock(DeviceObject, Irp);
        if (isRemoved) {
            Irp->IoStatus.Status = STATUS_DEVICE_DOES_NOT_EXIST;
            ClassReleaseRemoveLock(DeviceObject, Irp);
            ClassCompleteRequest(DeviceObject, Irp, IO_NO_INCREMENT);
            status = STATUS_DEVICE_DOES_NOT_EXIST;
        }
        else if (TEST_FLAG(DeviceObject->Flags, DO_VERIFY_VOLUME) &&
                 (currentIrpStack->MinorFunction != CLASSP_VOLUME_VERIFY_CHECKED) &&
                 !TEST_FLAG(currentIrpStack->Flags, SL_OVERRIDE_VERIFY_VOLUME)){
    
            /*
             *  DO_VERIFY_VOLUME is set for the device object,
             *  but this request is not itself a verify request.
             *  So fail this request.
             */
            if (Irp->Tail.Overlay.Thread != NULL) {
                IoSetHardErrorOrVerifyDevice(Irp, DeviceObject);
            }
            Irp->IoStatus.Status = STATUS_VERIFY_REQUIRED;
            Irp->IoStatus.Information = 0;
            ClassReleaseRemoveLock(DeviceObject, Irp);
            ClassCompleteRequest(DeviceObject, Irp, 0);
            status = STATUS_VERIFY_REQUIRED;
        }


    It goes into below branch:

    if (TEST_FLAG(DeviceObject->Flags, DO_VERIFY_VOLUME) &&
                 (currentIrpStack->MinorFunction != CLASSP_VOLUME_VERIFY_CHECKED) &&
                 !TEST_FLAG(currentIrpStack->Flags, SL_OVERRIDE_VERIFY_VOLUME))

    {

    ...

    }


    It is the life.

    Monday, November 30, 2015 3:03 AM
  • I checked Microsoft SD Host controller in-box driver and find it has same fail phenomenon.

    1. RTD3 case:

        Test Step:

         a) Format SD cad to NTFS;

         b) Wait SD Card enter into D3 State;

         c) Execute CHKDSK for SD card;

         Test Result:

    Win8 x64

    Win8.1 x64 9600

    Win10 x64 10586

    Failed, card is raw type.

    Ok, check disk successfully

    Ok, check disk successfully

    2. S3/Resume case:

        Test Step:

         a) Format SD cad to NTFS;

         b) Enter into sleep mode(S3);

         c) Resume to S0

         d) Execute CHKDSK for SD card;

         Test Result:

    Win8 x64

    Win8.1 x64 9600

    Win10 x64 10586

    Failed, card is raw type.

    Failed, card is raw type.

    Failed, card is raw type.

    Below is the screenshot of failed phenomenon.


    It is the life.

    Tuesday, December 1, 2015 9:52 AM