Releasing PagingIoResource in filter

Hi all!

I am writing NTFS encryption filter driver. It encrypts/decrypts only IRPs
with IRP_PAGING_IO, IRP_SYNCHRONOUS_PAGING_IO or IRP_NOCACHE flags.

For the write IRP the driver calls IoSetCompletionRoutine() in order to set
its completion routine.

In the completion routine I would like to save my metadata in the extended
attribute. But if I just build IRP_MJ_SET_EA Irp and send it to FSD, it
causes deadlock since FSD is trying to acquire PagingIoResource exclusively.

Is it correct to release PagingIoResource, send Irp, acquire
PagingIoResource, return from completion routine?

If not, can you advise another solution?

Thanks,

Dani

There are many problems with the approach, for example you may not be able to
re-acquire resource from completion routine it it is executed on DPC level.
In general releasing locks that you didn’t acquire may violate assumptions of
the driver which acquired the lock. It may lead to deadlocks that are
difficult to track down or understand.
I would suggest to schedule a work item from the completion routine and
update EA from the work item.

Alexei.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Dani Polovets
Sent: Wednesday, July 18, 2007 6:37 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] Releasing PagingIoResource in filter

Hi all!

I am writing NTFS encryption filter driver. It encrypts/decrypts only IRPs
with IRP_PAGING_IO, IRP_SYNCHRONOUS_PAGING_IO or IRP_NOCACHE flags.

For the write IRP the driver calls IoSetCompletionRoutine() in order to set
its completion routine.

In the completion routine I would like to save my metadata in the extended
attribute. But if I just build IRP_MJ_SET_EA Irp and send it to FSD, it
causes deadlock since FSD is trying to acquire PagingIoResource exclusively.

Is it correct to release PagingIoResource, send Irp, acquire
PagingIoResource, return from completion routine?

If not, can you advise another solution?

Thanks,

Dani


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Thanks, Alexei.

The problem is that EA should be updated before Write Irp completion.

Dani


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Alexei Jelvis
Sent: Wednesday, July 18, 2007 9:19 PM
To: Windows File Systems Devs Interest List
Subject: RE: [ntfsd] Releasing PagingIoResource in filter

There are many problems with the approach, for example you may not be able
to re-acquire resource from completion routine it it is executed on DPC
level. In general releasing locks that you didn’t acquire may violate
assumptions of the driver which acquired the lock. It may lead to deadlocks
that are difficult to track down or understand.

I would suggest to schedule a work item from the completion routine and
update EA from the work item.

Alexei.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Dani Polovets
Sent: Wednesday, July 18, 2007 6:37 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] Releasing PagingIoResource in filter

Hi all!

I am writing NTFS encryption filter driver. It encrypts/decrypts only IRPs
with IRP_PAGING_IO, IRP_SYNCHRONOUS_PAGING_IO or IRP_NOCACHE flags.

For the write IRP the driver calls IoSetCompletionRoutine() in order to set
its completion routine.

In the completion routine I would like to save my metadata in the extended
attribute. But if I just build IRP_MJ_SET_EA Irp and send it to FSD, it
causes deadlock since FSD is trying to acquire PagingIoResource exclusively.

Is it correct to release PagingIoResource, send Irp, acquire
PagingIoResource, return from completion routine?

If not, can you advise another solution?

Thanks,

Dani


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com