Skip to contentSkip to conversation

Fix 'lvconvert -s' to work again

PATCH New Jun'ichi Nomura 2 participants 2 messages Aug 9, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix 'lvconvert -s' to work again

Hi,

In current CVS head, 'lvconvert -s' doesn't work.

 # lvconvert -s testvg/lvol0 testvg/lvol1
 --snapshots argument cannot be mixed with --mirrors or --log
 lvconvert: Change logical volume layout

This is due to the lvconvert parameter check uses 'count' variable uninitialized for non-mirror case.

        int count;
...
        if (arg_count(cmd, log_ARG) || arg_count(cmd, mirrors_ARG))
                count = 1;
        count += arg_count(cmd, snapshot_ARG);

While the code around the _read_params() could be tidied up some more, I hope this fix is included for now.

Thanks,

Signature · 8 lines
Jun'ichi Nomura, NEC Corporation of America
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lvm2-lvconvert-fix-arg-mixture-check.patch
Type: text/x-patch
Size: 655 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20070809/0a718685/attachment.bin>
#1 lore raw

PATCH 1/1 Fix 'lvconvert -s' to work again

Quoted 9 lines · Jun'ichi Nomura

Hi,

In current CVS head, 'lvconvert -s' doesn't work.

 # lvconvert -s testvg/lvol0 testvg/lvol1
 --snapshots argument cannot be mixed with --mirrors or --log
 lvconvert: Change logical volume layout

This is due to the lvconvert parameter check uses 'count' variable uninitialized for non-mirror case.

Quoted 9 lines
        int count;
...
        if (arg_count(cmd, log_ARG) || arg_count(cmd, mirrors_ARG))
                count = 1;
        count += arg_count(cmd, snapshot_ARG);

While the code around the _read_params() could be tidied up some more, I hope this fix is included for now.

Looks like an obvious initialization bug.