We’re seeing some performance degradation when we copy files across the network and our minifilter is installed. I’ve traced this to the FltGetFileNameInformation call (for the normalized name) by montioring the SMB traffic with Wireshark. We always call this in the same way:
status = FltGetFileNameInformation( Data,
FLT_FILE_NAME_NORMALIZED |
FLT_FILE_NAME_QUERY_DEFAULT,
&pNameInfo );
My understanding is that when a call is made to FltGtFileNameInformation, the name should be stored in the name cache. We currently call this function from the PreCallbacks on IRP_MJ_ACQUIRE_FOR_SECTION_SYNCHRONIZATION, IRP_MJ_CREATE and IRP_MJ_CLEANUP but it seems to go through the whole nightmare of retrieving the normalized name on each call. I would have expected to take the hit the first time around but then retrieve it from the cache on subsequent calls. As an experiment I tried modifying the flags to FLT_FILE_NAME_QUERY_CACHE_ONLY in the cleanup but this failed with STATUS_FLT_NAME_CACHE_MISS.
Is the name cache entry just valid for the duration of the current IRP (in otherwords, is it valid for other minifilters but not other IRPs) or is it reasonable to assume that the cache entries might (but not necessarily will) persist across two or more of my dispatch functions? Also, does the cache entry lifetime behave differently for network files ?? I know that FltGetFileNameInformation will queue requests off to a worker thread if there is less than 50% of stack space remaining (on x86 at least). Is it possible that a name cache entry is tied to a specific thread and we are seeign the effects of that?
I understand that querying for the normalized name is an expenseive operation but we have to use the normalized name. We can always implement our own cache of course but in theory at least this seems unnecessary.
Regards
Mark