[lvm-devel] [PATCH] Fix removal of multiple devices from a mirror.

Milan Broz mbroz at redhat.com
Thu Dec 17 14:12:03 UTC 2009


On 12/17/2009 02:51 PM, Petr Rockai wrote:
> the code for removing mirror images, as it is, shifts the first failed
> leg twice and fails to shift the second failed one at all, which
> reorders the mirror image array in such a way that a wrong leg is
> removed as a result.

well the code is not easily readable for me.
but the fix seems correct.

> @@ -533,6 +533,7 @@ static int _remove_mirror_images(struct 
>  			    _is_mirror_image_removable(sub_lv, removable_pvs)) {
>  				if (!shift_mirror_images(mirrored_seg, s))
>  					return_0;
> +				s--; /* adjust counter after shifting */

uint32_t s;

if the s drops to max_uint here, it will skip to 0 in next loop.
well, another loop style is probably better...
but let's not complicate it now...

>  				new_area_count--;
>  			}
>  		}

ack.

Milan




More information about the lvm-devel mailing list