do I need handle spinlock in FS filter driver?

Do I need to handle spinlock in FS filter driver?
Or under any circumstances, do i need to handle spinlock with KeInitializeSpinLock() kind of functions?

You will likely need synchronization in the filter, and since there are
functions that run at DISPATCH_LEVEL you are likely to need spin locks.

Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

“xxxxx@shaw.ca” wrote in message news:xxxxx@ntfsd:

> Do I need to handle spinlock in FS filter driver?
> Or under any circumstances, do i need to handle spinlock with KeInitializeSpinLock() kind of functions?

>>Do I need to handle spinlock in FS filter driver?

That depends upon what exactly your driver do, isn’t it. You can have a simple pass through driver which does nothing but passes IRP to lower driver. You may not bother about spinlock at all in this case.

A likely possibility is already pointed by Mr. Don.

Actually, I will differ a bit from my esteemed colleagues on the list on this issue.

It is quite possible to build an entire file system driver without using a spin lock. While it is convenient to do so (e.g., you can use the interlocked list operations) it is certainly not required (and in fact, it is worthwhile looking at lock free data structures in any case, as they eliminate the need to use any locks.) In one file system I wrote several years back I deliberately chose to use only ERESOURCE locks, precisely to prove that I could do so… it worked quite well, in fact.

However, there is a priori no reason to avoid them, other than as an academic exercise.

Tony
OSR