[sheepdog] [PATCH] sheep/vdi: fix vdi snapshot deletion

Hitoshi Mitake mitake.hitoshi at gmail.com
Fri Feb 21 02:49:39 CET 2014


At Thu, 20 Feb 2014 18:23:14 +0800,
Liu Yuan wrote:
> 
> This fixes tests/func/044,046 failures and add some comment.
> 
> Signed-off-by: Liu Yuan <namei.unix at gmail.com>
> ---
>  sheep/vdi.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)

Looks good to me.
Reviewed-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>

> 
> diff --git a/sheep/vdi.c b/sheep/vdi.c
> index 2da82a2..60e32ec 100644
> --- a/sheep/vdi.c
> +++ b/sheep/vdi.c
> @@ -1097,8 +1097,6 @@ static int start_deletion(struct request *req, uint32_t vid)
>  		goto out;
>  	}
>  
> -	clear_parent_child_vdi(vid);
> -
>  	ret = fill_delete_vid_array(dw, root_vid);
>  	if (ret < 0) {
>  		ret = SD_RES_EIO;
> @@ -1113,6 +1111,18 @@ static int start_deletion(struct request *req, uint32_t vid)
>  		if (cloned) {
>  			dw->delete_vid_array[0] = vid;
>  			dw->delete_vid_count = 1;
> +			/*
> +			 * FIXME:
> +			 *
> +			 * We can't clear snapshot's parent because it is not
> +			 * removed. We only remove the whole snapshot chain. So
> +			 * we can only create MAX_CHILDREN snapshots for one
> +			 * base even if we later remove some of them.
> +			 *
> +			 * But for clone (writable snapshot, we can clear
> +			 * parent for deletion, thus make room for new clones.
> +			 */
> +			clear_parent_child_vdi(vid);
>  		} else {
>  			sd_debug("snapshot chain has valid vdi, just mark vdi %"
>  				 PRIx32 " as deleted.", dw->target_vid);
> -- 
> 1.8.1.2
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list