From db6283385cb708b9d589e5b57e96eab4afd0269e Mon Sep 17 00:00:00 2001 From: Alberto Garcia Date: Mon, 8 Jun 2015 18:17:45 +0200 Subject: throttle: acquire the ThrottleGroup lock in bdrv_swap() bdrv_swap() touches the fields of a BlockDriverState that are protected by the ThrottleGroup lock. Although those fields end up in their original place, they are temporarily swapped in the process, so there's a chance that an operation on a member of the same group happening on a different thread can try to use them. Signed-off-by: Alberto Garcia Reviewed-by: Stefan Hajnoczi Message-id: d92dc40d7c4f1fc5cda5cbbf4ffb7a4670b79d17.1433779731.git.berto@igalia.com Signed-off-by: Stefan Hajnoczi --- include/block/throttle-groups.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/block/throttle-groups.h b/include/block/throttle-groups.h index 322139a..fab113f 100644 --- a/include/block/throttle-groups.h +++ b/include/block/throttle-groups.h @@ -40,4 +40,7 @@ void coroutine_fn throttle_group_co_io_limits_intercept(BlockDriverState *bs, unsigned int bytes, bool is_write); +void throttle_group_lock(BlockDriverState *bs); +void throttle_group_unlock(BlockDriverState *bs); + #endif -- cgit v1.1