[sheepdog] [PATCH 1/2] sheep:fix automatic stale object purging

Liu Yuan namei.unix at gmail.com
Tue Mar 19 08:23:08 CET 2013


On 03/16/2013 03:01 PM, wangfan wrote:
> If sheep process have differert disk size,after recovery. ./stale directory
> still have objects.because in the cluster_recovery_completion function,
> the memcmp function parameter vnode_info->nodes and recovereds will have
> different nr_vnodes number after recovery completion.so i just compare
> node_id to fix this problem.
> 
> Signed-off-by: wangfan <wangfan1985 at gmail.com>
> ---
>  sheep/ops.c |   16 ++++++++++------
>  1 files changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/sheep/ops.c b/sheep/ops.c
> index b9634ae..670800e 100644
> --- a/sheep/ops.c
> +++ b/sheep/ops.c
> @@ -626,12 +626,16 @@ static int cluster_recovery_completion(const struct sd_req *req,
>  
>  	vnode_info = get_vnode_info();
>  
> -	if (vnode_info->nr_nodes == nr_recovereds &&
> -	    memcmp(vnode_info->nodes, recovereds,
> -		   sizeof(*recovereds) * nr_recovereds) == 0) {
> -		sd_dprintf("all nodes are recovered at epoch %d", epoch);
> -		if (sd_store->cleanup)
> -			sd_store->cleanup();
> +	if (vnode_info->nr_nodes == nr_recovereds){
> +		for (i = 0; i < nr_recovereds; ++i){
> +			if (node_id_cmp(&vnode_info->nodes[i].nid , &recovereds[i].nid))
> +				break;
> +		}
> +		if(i == nr_recovereds){
> +			sd_dprintf("all nodes are recovered at epoch %d", epoch);
> +			if (sd_store->cleanup)
> +				sd_store->cleanup();
> +		}
>  	}
>  
>  	put_vnode_info(vnode_info);
> 

I have run ./script/checkpatch.pl against this patch. There are some
coding style problems. Please fix them and resend it.

Thanks,
Yuan



More information about the sheepdog mailing list