Skip to content

Commit eb9148b

Browse files
Remove blocks from free list when extending an LV
Before this patch, the LvExpand operation was removing blocks from the free list and giving them to the LV but the following LvCrop operation was then adding these blocks back into the free list leading to duplicate allocations. Signed-off-by: Si Beaumont <[email protected]>
1 parent a259705 commit eb9148b

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

xenvmd/xenvmd.ml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -379,14 +379,10 @@ module VolumeManager = struct
379379
debug "FromLVM queue %s has %d items" name (List.length items);
380380
Lwt_list.iter_s (function { ExpandVolume.volume; segments } ->
381381
write (fun vg ->
382-
debug "Expanding volume %s" volume;
383-
let id = (Lvm.Vg.LVs.find_by_name volume vg.Lvm.Vg.lvs).Lvm.Lv.id in
384-
Lvm.Vg.do_op vg (Lvm.Redo.Op.(LvExpand(id, { lvex_segments = segments })))
385-
) >>= fun () ->
386-
write (fun vg ->
387-
debug "Removing free blocks from %s free LV" name;
388-
let (_,freeid) = (List.assoc name !free_LVs) in
389-
Lvm.Vg.do_op vg (Lvm.Redo.Op.(LvCrop(freeid, { lvc_segments = segments })))
382+
debug "Expanding volume %s" volume;
383+
let id = (Lvm.Vg.LVs.find_by_name volume vg.Lvm.Vg.lvs).Lvm.Lv.id in
384+
let (_, free_id) = (List.assoc name !free_LVs) in
385+
Lvm.Vg.do_op vg (Lvm.Redo.Op.(LvTransfer(free_id, id, segments)))
390386
)
391387
) items
392388
>>= fun () ->

0 commit comments

Comments
 (0)