* [PATCH] Propagate inability to allocate extents for log on provided area.
@ 2009-05-27 11:08 Milan Broz
0 siblings, 0 replies; only message in thread
From: Milan Broz @ 2009-05-27 11:08 UTC (permalink / raw)
To: lvm-devel
Propagate inability to allocate extents for log on provided area.
Easily reproducible with (bug 502761)
vgcreate -s 1k ..
lvcreate -m1 ... <leg1_dev> <leg2_dev> <log_dev>:0-0
Here it needs 2 extents for log but only one is provided.
Currently code fails on assert inside consume_pv_area, now
it should print proper error message.
"Insufficient extents for log allocation for logical volume"
(Patch is more workaround than real fix, the allocation code is not too
user friendly regarding error reporting but it waits for some rewrite:-)
Signed-off-by: Milan Broz <mbroz@redhat.com>
---
lib/metadata/lv_manip.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index eeb4710..7a58a80 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -766,7 +766,14 @@ static int _alloc_parallel_area(struct alloc_handle *ah, uint32_t needed,
ah->log_area.len = mirror_log_extents(ah->log_region_size,
pv_pe_size(log_area->map->pv),
area_len);
- consume_pv_area(log_area, ah->log_area.len);
+ /*
+ * Provided log area is too small,
+ * set zero length to notify layer above
+ */
+ if (ah->log_area.len > log_area->count)
+ ah->log_area.len = 0;
+ else
+ consume_pv_area(log_area, ah->log_area.len);
}
*ix += area_len * ah->area_multiple;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-05-27 11:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-27 11:08 [PATCH] Propagate inability to allocate extents for log on provided area Milan Broz
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.