[linux-lvm] lvconvert --merge bug

Mike Snitzer snitzer at redhat.com
Sun Jul 17 12:23:01 UTC 2011

On Sun, Jul 17 2011 at  1:29am -0400,
ben <benscott at nwlink.com> wrote:

> 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

        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 */
                                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!

> 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


More information about the linux-lvm mailing list