ctx->used must be set while holding the mutex

Signed-off-by: Simon Derr <simon.derr@bull.net>