[Sheepdog] [PATCH] fix a bug of deleting base vdi fail

levin li levin108 at gmail.com
Wed May 2 06:04:30 CEST 2012


On 05/02/2012 12:03 PM, Li Wenpeng wrote:
> From: levin li<xingke.lwp at taobao.com>
>
> Take a view of the following snapshot chain:
>
> base vdi -->  snapshot vdi -->  cloned vdi
>
> when cloned vdi has its own data objects created by copy-on-write,
> we firstly delete the cloned vdi, the delete the base vdi, at last
> we delete snapshot vdi.
>
> when deleting the snapshot vdi, it try to traverse the snapshot chain to
> cleanup all the data objects, but the copy-on-write objects has been
> deleted by the first deletion work, so it may get failed and set the
> dw->delete_error to be true, it doesn't matter for the future deletion,
> we just need to guarantee the objects of the snapshot vdi deleteing success,
> but before this, we need to clear the previous error flag at dw->delete_error,
> orelse it may cause failure of deleting the snapshot vdi.
>
> Signed-off-by: levin li<xingke.lwp at taobao.com>
> ---
>   sheep/vdi.c |    2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/sheep/vdi.c b/sheep/vdi.c
> index 0788f26..f415189 100644
> --- a/sheep/vdi.c
> +++ b/sheep/vdi.c
> @@ -469,6 +469,8 @@ static void delete_one(struct work *work)
>   		goto out;
>   	}
>
> +	dw->delete_error = 0;
> +
>   	for (i = 0; i<  MAX_DATA_OBJS; i++) {
>   		if (!inode->data_vdi_id[i])
>   			continue;
This bug was introduced in my previous patch
(dabb5200202f2225e69002c055afba97ee5cf73a),
sorry for my mistake.

thanks,
levin



More information about the sheepdog mailing list