[sheepdog] [PATCH] sheep: manual restore needs to update the objlist cache

Liu Yuan namei.unix at gmail.com
Fri May 25 16:59:47 CEST 2012


On 05/25/2012 10:43 PM, Christoph Hellwig wrote:

> restore_objects_from_snap can write objects to disk without going
> through store_create_and_write_obj, and thus currently fails to update
> the object list cache. 
> 
> Found by code inspection when debugging a similar problem in the recovery
> code.
> 
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> 
> diff --git a/sheep/farm/farm.c b/sheep/farm/farm.c
> index 1575d24..ef88ff6 100644
> --- a/sheep/farm/farm.c
> +++ b/sheep/farm/farm.c
> @@ -645,8 +645,10 @@ static int restore_objects_from_snap(uint32_t epoch)
>  		if (ret != SD_RES_SUCCESS) {
>  			eprintf("oid %"PRIx64" not restored\n", oid);
>  			goto out;
> -		} else
> -			dprintf("oid %"PRIx64" restored\n", oid);
> +		}
> +
> +		check_and_insert_objlist_cache(oid);
> +		dprintf("oid %"PRIx64" restored\n", oid);
>  
>  		free(buffer);
>  	}


Hmmm, nice catch. By a glance of the code, I think we also need to call
trunk_reset() to clear the trunk_active_list firstly in this function.

Thanks,
Yuan



More information about the sheepdog mailing list