Skip to contentSkip to conversation

lvconvert --merge bug

linux-lvm ben 2 participants 2 messages Jul 17, 2011

lore
Share & tools
lore

ben

author
#0 lore raw

I was playing with snapshot merging a discovered a problem. If a snap starts out as invalid the merge command starts merging and then quits. That leaves the snap in a strange condition. It is listed as merging even though the merge failed. It also becomes tricky to delete the invalid snap. It would seem better if the merge command checked the validity first.

I also have a question. The error message from lvconvert suggests that the snap might become invalid <during> the merge. If that happens does the origin get scrambled?

Thank you.

#1 lore raw
Quoted 5 lines · ben

I was playing with snapshot merging a discovered a problem. If a snap starts out as invalid the merge command starts merging and then quits. That leaves the snap in a strange condition. It is listed as merging even though the merge failed. It also becomes tricky to delete the invalid snap. It would seem better if the merge command checked the validity first.

I agree that it should check for invalid, but looking at tools/lvconvert.c:_lvconvert_single it clearly doesn't.

The code to check if a snapshot is invalid is a bit cumbersome (from lib/metadata/lv.c:lv_attr_dup):

        if (lv_info(lv->vg->cmd, lv, 0, &info, 1, 0) && info.exists) {
	   ...
                /* Snapshot dropped? */
                if (info.live_table && lv_is_cow(lv) &&
                    (!lv_snapshot_percent(lv, &snap_percent) ||
                     snap_percent == PERCENT_INVALID)) {
                        repstr[0] = toupper(repstr[0]);
                        if (info.suspended)
                                repstr[4] = 'S'; /* Susp Inv snapshot */
                        else
                                repstr[4] = 'I'; /* Invalid snapshot */
                }

Seems we don't have this check for invalid snapshot factored out for lvconvert to easily consume.

Anyway, we just need to work through the proper fix. Thanks for reporting the issue!

Quoted 3 lines

I also have a question. The error message from lvconvert suggests that the snap might become invalid <during> the merge. If that happens does the origin get scrambled?

Can you please be more specific on which error message you're referring to?

Thanks,
Mike