about FCB_STATE_WRITECACHEING_ENABLED

I have developped a on-the-fly encryption filter,it works well on the local file system in

WinNT/2K/XP/2K3.
Now,I will make my filter works well on the RDR.I have read the “Caching in Network File Systems”,I

have implement the Read operation.And I have make the write-only IRP_MJ_CREATE to the read-write

IRP_MJ_CREATE(for RDR can cache).
But,when I handle the IRP_MJ_WRITE,there’s trouble!

I want to decide the cache-state by FCB_STATE_READCACHEING_ENABLED,I do the following:
the following code is in the cached IRP_MJ_READ routing.

PFSRTL_COMMON_FCB_HEADER pCommonFcb=(PFSRTL_COMMON_FCB_HEADER)(pFileObject->FsContext);
FsRtlEnterFileSystem();
if (pCommonFcb->Resource)
ExAcquireResourceExclusive(pCommonFcb->Resource, TRUE );
bCached=pCommonFcb->FcbState & FCB_STATE_READCACHEING_ENABLED;
nRet=JustCallFileSystem(pDevObj,Irp); //call down,and wait for completion
if (pCommonFcb->Resource)
ExReleaseResource(pCommonFcb->Resource);
FsRtlExitFileSystem();

My filter works well by the above code fragment.

Now,I want to decide the cache-state by FCB_STATE_WRITECACHEING_ENABLED,I do the following:
the following code is in the cached IRP_MJ_WRITE routing.

PFSRTL_COMMON_FCB_HEADER pCommonFcb=(PFSRTL_COMMON_FCB_HEADER)(pFileObject->FsContext);
FsRtlEnterFileSystem();
if (pCommonFcb->Resource)
ExAcquireResourceExclusive(pCommonFcb->Resource, TRUE );
bCached=pCommonFcb->FcbState & FCB_STATE_WRITECACHEING_ENABLED;
nRet=JustCallFileSystem(pDevObj,Irp); //call down,and wait for completion
if (pCommonFcb->Resource)
ExReleaseResource(pCommonFcb->Resource);
FsRtlExitFileSystem();

My filter will dead-lock!

I know the filter can’t rely on the non-cache or cache state in IRP,I should use the layered FSD.
But,I just want to support the MS FSD,so I don’t care it.
And,I know in vista,these will change,but I don’t care it.

I don’t do the above code in FastWrite,because it should be cached write in FastIO.
Anybody can explain these question:
1.How can I do the FCB_STATE_WRITECACHEING_ENABLED decision in synchronizing the RDR?
2.I should have made the RDR caching the files(write-only -> read-write),why the RDR do the non-cache

write in a cache IRP_MJ_WRITE(or FastWrite?)?
3.If the question 1 is impossible,Can I disabled the cache by registry key?
So,the RDR will read and write the file in non-cached way.