mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-11 20:58:50 +03:00
Explicitely check list size of segments
instead of checking for NULL from last_seg and first_seg.
This commit is contained in:
parent
c3cb4bb872
commit
9cdfa9e854
@ -2093,7 +2093,8 @@ int lv_add_virtual_segment(struct logical_volume *lv, uint64_t status,
|
||||
}
|
||||
}
|
||||
|
||||
if ((seg = last_seg(lv)) && (seg->segtype == segtype)) {
|
||||
if (!dm_list_empty(&lv->segments) &&
|
||||
(seg = last_seg(lv)) && (seg->segtype == segtype)) {
|
||||
seg->area_len += extents;
|
||||
seg->len += extents;
|
||||
} else {
|
||||
@ -2411,7 +2412,7 @@ static int _lv_insert_empty_sublvs(struct logical_volume *lv,
|
||||
char img_name[len];
|
||||
struct lv_segment *mapseg;
|
||||
|
||||
if (lv->le_count || first_seg(lv)) {
|
||||
if (lv->le_count || !dm_list_empty(&lv->segments)) {
|
||||
log_error(INTERNAL_ERROR
|
||||
"Non-empty LV passed to _lv_insert_empty_sublv");
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user