From Linux NFS
Note all the places where something could go wrong (due to user error, or whatever) while setting up an NFSv4 client or server, try it, and see if what happens points you towards the solution.
Example: svcgssd doesn't always give helpful errors on context creation failures, do to two problems: 1. Our kernel gss code is returning -EINVAL on most errors. 2. svcgssd is using nfs-utils qword_* functions, wihch don't return errors.
Fixing #1 is just a matter of choosing appropriate error codes--just find existing errno's which aren't otherwise used and have some vague relationship to the problem. For number 2, we should just make the relevant functions return int instead of void.