Extensive mutex locking in lookup_nfs4_server()
The lookup_nfs4_server() is walking through the nfs4_server_lst list and acquires s_lock mutex for every entry there. This is not very optimal and it is definitively not needed. We could improve the implementation in two ways:
- Acquire the s_lock only in a case the current entry (np) match the passed entry (sp),
- once we found the sp in the list (so np == sp) we should stop the walk. There is no way how we could find sp in the list again.
As a minor improvement we should add
ASSERT(sp != &nfs4_server_lst) at the beginning of the function.