Re: IRP_MN_QUERY_DEVICE_RELATIONS concurrency by Doron
Doron
Thu Dec 28 13:33:14 CST 2006
the paging file and crash dump files are not true "files", you will not see
a create irp for them. as for query stop, you will need to pend i/o until
you get the cancel q.s. or the start irp again and then start processing
i/o. if a usage notification has already been sent and succeeded,fail the
q.s.
d
--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
<BubbaGump> wrote in message
news:r1r7p2pe3kdclue8dugsc3ml9acgf6pnhs@4ax.com...
>I do question the idea of safety in this situation. If
> IRP_MN_DEVICE_USAGE_NOTIFICATION was succeeded after
> IRP_MN_QUERY_REMOVE_DEVICE then wouldn't the paging, crash dump, or
> hibernation file still need to be opened on the device, and isn't
> opening a file on a device synchronized with
> IRP_MN_QUERY_REMOVE_DEVICE in Windows 2000 and later? Perhaps this is
> what Tim meant? I suppose IRP_MN_DEVICE_USAGE_NOTIFICATION in this
> situation is slightly redundant and would only prevent an error
> message that the file could not be opened from popping up later.
>
> That still leaves IRP_MN_QUERY_STOP_DEVICE. The OS doesn't
> synchronize IRP_MN_QUERY_STOP_DEVICE with file opens, does it? What
> if the device was stopped while being used for a paging file?
> IRP_MN_QUERY_STOP_DEVICE is only for resource re-balancing, so it
> would only temporarily stop paging, right? Is any of the OS code that
> sends IRP_MN_QUERY_STOP_DEVICE or IRP_MN_STOP_DEVICE pageable? If so
> then I guess this could hang the system.
>
> -----
>
> These possibilities get complicated. It might be easier to do the
> right thing (synchronization) than to imagine all the consequences of
> doing the wrong thing. It's like lying. Once a lie is told it costs
> additional supporting lies later on. The truth is often cheaper.
>
>
>
>
> On Wed, 27 Dec 2006 15:56:55 -0500, BubbaGump <> wrote:
>
>>Not have to worry too much? Yes, a race is unlikely but software
>>should be designed without any race conditions except special
>>situations where all possible outcomes of the race can be handled
>>safely ("safely" being open to interpretation).
>>
>>In this situation, one of the possible outcomes is unsafe (could lead
>>to an in-use resource being freed). The probability that it will
>>happen is irrelevant.
>>
>>
>>
>>
>>On Wed, 27 Dec 2006 10:07:30 -0800, "Doron Holan [MS]"
>><doronh@nospam.microsoft.com> wrote:
>>
>>>IRP_MN_USAGE_NOTIFICATION is not tied to pnp state directly. you can
>>>tell
>>>b/c as i indicated earlier, if another driver can the irp (which any
>>>driver
>>>can), then it is not part of the pnp state machine maintained by the pnp
>>>manager. fortunately, this irp is sent well before a q.r. can be sent so
>>>you don't have to worry too much about synchronizing with q.r. ... as
>>>maxim
>>>said, you do have to make sure that you are not power pagable anymore if
>>>you
>>>succeed any of the usages.
>>>
>>>d
>