[sheepdog] [PATCH 1/2] md: purge directory only when md_add_disk() succeed

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Fri May 10 07:41:34 CEST 2013


At Fri, 10 May 2013 13:33:00 +0800,
Liu Yuan wrote:
> 
> @@ -608,13 +609,12 @@ static int do_plug_unplug(char *disks, bool plug)
>  	old_nr = md_nr_disks;
>  	path = strtok(disks, ",");
>  	do {
> -		if (purge_directory(path) < 0)
> -			goto out;
> -
> -		if (plug)
> -			md_add_disk(path);
> -		else
> +		if (plug) {
> +			if (md_add_disk(path) && purge_directory(path) < 0)
> +					goto out;

Wrong indentation.

What happens if md_add_disk() succeeds but purge_directory() fails?
Should we call md_del_disk() against the added disk?

Thanks,

Kazutaka



More information about the sheepdog mailing list