Added state_lock_locked and state_unlock_locked functions

Some callers already have pthread read/write "state_lock" acquired, so
they need locked versions of state_lock and state_unlock functions.
ported from: ab3318ce313b4f53feec833e84adea365f5a839f

Signed-off-by: Srikrishan Malik <srimalik@in.ibm.com>
Use state_unlock_locked in deleg_revoke and delegreturn.

This will prevent races between the two paths.

Signed-off-by: Srikrishan Malik <srimalik@in.ibm.com>