All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vg_validate support for pvmove LVs (BZ 662669)
@ 2010-12-13 21:24 Petr Rockai
  2010-12-14  8:51 ` Zdenek Kabelac
  2010-12-14 11:59 ` Alasdair G Kergon
  0 siblings, 2 replies; 3+ messages in thread
From: Petr Rockai @ 2010-12-13 21:24 UTC (permalink / raw)
  To: lvm-devel

Hi,

I am attaching patch that revs up vg_validate somewhat, to catch some
malformed (internal) pvmoveN LVs. Currently, it checks that the segments
in there are either linear or mirrored with 2 legs. Unfortunately, I
haven't been able to come up with any further restrictions that wouldn't
break the existing tests on some count. It seems that vg_validate is
called on VGs where linear segments exist (although I have been unable
to capture them at vg_commit time), and they are interspersed with
mirrored segments in the same LV. I have already spent a lot of time on
this, so if someone wants to come up with a stricter check, please feel
free to do so.

Anyway, the attached patch does catch the bug triggered by kabi's test
attached to BZ 654447. For the other bug (dangling reference) I will
submit a separate BZ and a separate patch, hopefully tomorrow.

Yours,
   Petr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: vg_validate-pvmove.diff
Type: text/x-diff
Size: 1254 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20101213/096bfb2b/attachment.bin>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] vg_validate support for pvmove LVs (BZ 662669)
  2010-12-13 21:24 [PATCH] vg_validate support for pvmove LVs (BZ 662669) Petr Rockai
@ 2010-12-14  8:51 ` Zdenek Kabelac
  2010-12-14 11:59 ` Alasdair G Kergon
  1 sibling, 0 replies; 3+ messages in thread
From: Zdenek Kabelac @ 2010-12-14  8:51 UTC (permalink / raw)
  To: lvm-devel

Dne 13.12.2010 22:24, Petr Rockai napsal(a):
> Hi,
> 
> I am attaching patch that revs up vg_validate somewhat, to catch some
> malformed (internal) pvmoveN LVs. Currently, it checks that the segments
> in there are either linear or mirrored with 2 legs. Unfortunately, I
> haven't been able to come up with any further restrictions that wouldn't
> break the existing tests on some count. It seems that vg_validate is
> called on VGs where linear segments exist (although I have been unable
> to capture them at vg_commit time), and they are interspersed with
> mirrored segments in the same LV. I have already spent a lot of time on
> this, so if someone wants to come up with a stricter check, please feel
> free to do so.
> 
> Anyway, the attached patch does catch the bug triggered by kabi's test
> attached to BZ 654447. For the other bug (dangling reference) I will
> submit a separate BZ and a separate patch, hopefully tomorrow.
> 
> Yours,

>  
> +	dm_list_iterate_items(lvl, &vg->lvs) {
> +		if (!(lvl->lv->status & PVMOVE))
> +			continue;

Optionally - it could be put as call of local function into the same
dm_list_iterate_items() few lines above ?

i.e.
  if ((lvl->lv->status & PVMOVE) && !_validate_pvmove(lvl->lv))
	r = 0;

> +		dm_list_iterate_items(seg, &lvl->lv->segments) {
> +			if (seg_is_mirrored(seg)) {
> +				if (seg->area_count != 2) {
> +					log_error(INTERNAL_ERROR
> +						  "Segment %d in %s is not 2-way.",
> +						  loop_counter1, lvl->lv->name);
> +					r = 0;
> +				}
> +			} else if (seg->area_count != 1) {
> +				log_error(INTERNAL_ERROR
> +					  "Segment %d in %s has wrong number of areas: %d.",
> +					  loop_counter1, lvl->lv->name, seg->area_count);
> +				r = 0;
> +			}
> +		}

and move this into static _validate_pvmove().

Zdenek



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] vg_validate support for pvmove LVs (BZ 662669)
  2010-12-13 21:24 [PATCH] vg_validate support for pvmove LVs (BZ 662669) Petr Rockai
  2010-12-14  8:51 ` Zdenek Kabelac
@ 2010-12-14 11:59 ` Alasdair G Kergon
  1 sibling, 0 replies; 3+ messages in thread
From: Alasdair G Kergon @ 2010-12-14 11:59 UTC (permalink / raw)
  To: lvm-devel

On Mon, Dec 13, 2010 at 10:24:46PM +0100, Peter Rockai wrote:
> +					log_error(INTERNAL_ERROR
> +						  "Segment %d in %s is not 2-way.",
> +						  loop_counter1, lvl->lv->name);

> +				log_error(INTERNAL_ERROR
> +					  "Segment %d in %s has wrong number of areas: %d.",
> +					  loop_counter1, lvl->lv->name, seg->area_count);

I was going to say 'add pvmove' to the messages, but the LV name is already
going to tell you that.  
Ack.

Alasdair



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-14 11:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-13 21:24 [PATCH] vg_validate support for pvmove LVs (BZ 662669) Petr Rockai
2010-12-14  8:51 ` Zdenek Kabelac
2010-12-14 11:59 ` Alasdair G Kergon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.