[sheepdog] [PATCH v2 1/2] md: purge directory before md_add_disk

Liu Yuan namei.unix at gmail.com
Thu Sep 5 04:45:05 CEST 2013


On Thu, Sep 05, 2013 at 10:41:47AM +0800, Liu Yuan wrote:
> Or it will falsely remove .stale directory for newly added disk.
> 
> Signed-off-by: Liu Yuan <namei.unix at gmail.com>
> ---
>  sheep/md.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/sheep/md.c b/sheep/md.c
> index 37feeb2..1339527 100644
> --- a/sheep/md.c
> +++ b/sheep/md.c
> @@ -614,8 +614,10 @@ static int do_plug_unplug(char *disks, bool plug)
>  	path = strtok(disks, ",");
>  	do {
>  		if (plug) {
> -			if (md_add_disk(path) && purge_directory(path) < 0)
> -				md_del_disk(path);
> +			if (purge_directory(path) < 0)
> +				sd_err("failed to purge %s", path);
> +			if (!md_add_disk(path))
> +				sd_err("failed to add %s", path);
>  		} else {
>  			md_del_disk(path);
>  		}
> -- 
> 1.7.9.5
> 

Please ignore this patchset. This is wrong too

Thanks
Yuan



More information about the sheepdog mailing list