mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
lvconvert: check if LV has cow type
Cow may not be a COW type, the return value of origin_from_cow(cow) may be NULL. Reported-by: Wu Guanghao <wuguanghao3@huawei.com> Reported-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
This commit is contained in:
parent
463a61e62e
commit
a9cb96f146
@ -1825,6 +1825,11 @@ static int _lvconvert_splitsnapshot(struct cmd_context *cmd, struct logical_volu
|
|||||||
struct volume_group *vg = cow->vg;
|
struct volume_group *vg = cow->vg;
|
||||||
const char *cow_name = display_lvname(cow);
|
const char *cow_name = display_lvname(cow);
|
||||||
|
|
||||||
|
if (!lv_is_cow(cow)) {
|
||||||
|
log_error(INTERNAL_ERROR "Volume %s is not a COW.", cow_name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (lv_is_virtual_origin(origin_from_cow(cow))) {
|
if (lv_is_virtual_origin(origin_from_cow(cow))) {
|
||||||
log_error("Unable to split off snapshot %s with virtual origin.", cow_name);
|
log_error("Unable to split off snapshot %s with virtual origin.", cow_name);
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user