Hello,
I recently encountered the following problem:
The system has crashed with ATTEMPTED_SWITCH_FROM_DPC in IRP_MJ_WRITE
post-op callback.
The crash was caused by calling FltGetStreamHandleContext().
Looking in the docs, I indeed noticed that it should be called at *IRQL: *<=
APC_LEVEL.
There are several ways to defer the operation, but *
FltDoCompletionProcessingWhenSafe*, for example, says that it cannot be used
for read and write.
Which way would you recommend to go here?
Thanks in advance,
G.
You could collect the context in pre-write and pass it across to post-write…
“Greg” wrote in message news:xxxxx@ntfsd…
Hello,
I recently encountered the following problem:
The system has crashed with ATTEMPTED_SWITCH_FROM_DPC in IRP_MJ_WRITE post-op callback.
The crash was caused by calling FltGetStreamHandleContext().
Looking in the docs, I indeed noticed that it should be called at IRQL: <= APC_LEVEL.
There are several ways to defer the operation, but FltDoCompletionProcessingWhenSafe, for example, says that it cannot be used for read and write.
Which way would you recommend to go here?
Thanks in advance,
G.
1 Like
Hi Rod,
Thanks for the answer.
I forgot to mention that I’m already in the post-write.
G,
On Sun, Oct 31, 2010 at 5:48 PM, Rod Widdowson wrote:
> You could collect the context in pre-write and pass it across to
> post-write…
>
> “Greg” wrote in message news:xxxxx@ntfsd…
> Hello,
>
> I recently encountered the following problem:
> The system has crashed with ATTEMPTED_SWITCH_FROM_DPC in IRP_MJ_WRITE
> post-op callback.
> The crash was caused by calling FltGetStreamHandleContext().
> Looking in the docs, I indeed noticed that it should be called at *IRQL: *<=
> APC_LEVEL.
> There are several ways to defer the operation, but
> FltDoCompletionProcessingWhenSafe, for example, says that it cannot be
> used for read and write.
>
> Which way would you recommend to go here?
>
> Thanks in advance,
> G.
>
>
> —
> NTFSD is sponsored by OSR
>
> For our schedule of debugging and file system seminars
> (including our new fs mini-filter seminar) visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
Yes, I understood that, but my suggestion was to change your pre-write to collect the SHcontext (unconditionally). Then you make that the context that you pass over to the post call. Hey presto you have access to the SHcontext in the post call and nothing fancy needed.
Of course you need to deref the context in the post call - but that can happen at DISPATCH_LEVEL…
“Greg” wrote in message news:xxxxx@ntfsd…
Hi Rod,
Thanks for the answer.
I forgot to mention that I’m already in the post-write.
G,
On Sun, Oct 31, 2010 at 5:48 PM, Rod Widdowson wrote:
You could collect the context in pre-write and pass it across to post-write…
“Greg” wrote in message news:xxxxx@ntfsd…
Hello,
I recently encountered the following problem:
The system has crashed with ATTEMPTED_SWITCH_FROM_DPC in IRP_MJ_WRITE post-op callback.
The crash was caused by calling FltGetStreamHandleContext().
Looking in the docs, I indeed noticed that it should be called at IRQL: <= APC_LEVEL.
There are several ways to defer the operation, but FltDoCompletionProcessingWhenSafe, for example, says that it cannot be used for read and write.
Which way would you recommend to go here?
Thanks in advance,
G.
—
NTFSD is sponsored by OSR
For our schedule of debugging and file system seminars
(including our new fs mini-filter seminar) visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
1 Like
Hi Rod,
Ah, now I get your point.
But how am I guaranteed the PRE- isn’t happening at the DPC level?
G.
On Sun, Oct 31, 2010 at 8:41 PM, Rod Widdowson wrote:
> Yes, I understood that, but my suggestion was to change your pre-write to
> collect the SHcontext (unconditionally). Then you make that the context
> that you pass over to the post call. Hey presto you have access to the
> SHcontext in the post call and nothing fancy needed.
>
> Of course you need to deref the context in the post call - but that can
> happen at DISPATCH_LEVEL…
>
>
> “Greg” wrote in message news:xxxxx@ntfsd…
> Hi Rod,
>
> Thanks for the answer.
> I forgot to mention that I’m already in the post-write.
>
> G,
>
> On Sun, Oct 31, 2010 at 5:48 PM, Rod Widdowson wrote:
>
>> You could collect the context in pre-write and pass it across to
>> post-write…
>>
>> “Greg” wrote in message news:xxxxx@ntfsd…
>> Hello,
>>
>> I recently encountered the following problem:
>> The system has crashed with ATTEMPTED_SWITCH_FROM_DPC in IRP_MJ_WRITE
>> post-op callback.
>> The crash was caused by calling FltGetStreamHandleContext().
>> Looking in the docs, I indeed noticed that it should be called at *IRQL:
>> *<= APC_LEVEL.
>> There are several ways to defer the operation, but
>> FltDoCompletionProcessingWhenSafe, for example, says that it cannot be
>> used for read and write.
>>
>> Which way would you recommend to go here?
>>
>> Thanks in advance,
>> G.
>>
>>
>> —
>> NTFSD is sponsored by OSR
>>
>> For our schedule of debugging and file system seminars
>> (including our new fs mini-filter seminar) visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>
>
> —
> NTFSD is sponsored by OSR
>
> For our schedule of debugging and file system seminars
> (including our new fs mini-filter seminar) visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
Contexts can be freed at DPC_LEVEL if they are allocated from
non-paged pool, so you can safely pass them to the post-write and
release them there. You can also assume the pre-write is not running at
DPC_LEVEL, as otherwise would indicate an error in another driver, not
yours.
Greg wrote:
Part 1.1Type: Plain Text (text/plain)
–
Kind regards, Dejan (MSN support: xxxxx@alfasp.com)
http://www.alfasp.com
File system audit, security and encryption kits.
>You can also assume the pre-write is not running at
DPC_LEVEL, as otherwise would indicate an error in another driver, not
yours.
Ah, this is what I wasn’t aware of. If so, I have a solution, as suggested
by Rod.
Thanks!
On Mon, Nov 1, 2010 at 12:54 PM, Dejan Maksimovic wrote:
>
> Contexts can be freed at DPC_LEVEL if they are allocated from
> non-paged pool, so you can safely pass them to the post-write and
> release them there. You can also assume the pre-write is not running at
> DPC_LEVEL, as otherwise would indicate an error in another driver, not
> yours.
>
> Greg wrote:
>
> > Part 1.1Type: Plain Text (text/plain)
>
> –
> Kind regards, Dejan (MSN support: xxxxx@alfasp.com)
> http://www.alfasp.com
> File system audit, security and encryption kits.
>
>
>
> —
> NTFSD is sponsored by OSR
>
> For our schedule of debugging and file system seminars
> (including our new fs mini-filter seminar) visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>