CA-114341

Fix broken parameter passing, and don't try to reacquire the lock if already done so.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>