Simplify the use of locks where possible, remove the locking when it is not
required.

Simplify the code a little bit.

Reviewed by:	andrew (previous version)


git-svn-id: svn+ssh://svn.freebsd.org/base/head@276059 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f