Bug 1342564 - pvmove not working correctly when using tags instead of device names
Summary: pvmove not working correctly when using tags instead of device names
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: LVM and device-mapper
Classification: Community
Component: lvm2
Version: 2.02.155
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
: ---
Assignee: David Teigland
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-03 14:20 UTC by Peter Rajnoha
Modified: 2020-08-21 21:23 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-08-21 21:23:53 UTC
Embargoed:
rule-engine: lvm-technical-solution?
rule-engine: lvm-test-coverage?


Attachments (Terms of Use)

Description Peter Rajnoha 2016-06-03 14:20:39 UTC
pvmove now uses process_each_pv inside and it can recognize tags instead of PV names. We need to look at this closer because not all scenarios work - if the tag points to one device, it works, but it fails in different ways if the tag encompasses more than one device.

For example (tested with current upstream HEAD, that is 68e097972462e3c7c208ac34c62e737b161dd3c4)

(with LVs allocated on PVs)
[0] fedora/~ # vgcreate vg /dev/sda /dev/sdb /dev/sdc /dev/sdd
  Physical volume "/dev/sda" successfully created.
  Physical volume "/dev/sdb" successfully created.
  Physical volume "/dev/sdc" successfully created.
  Physical volume "/dev/sdd" successfully created.
  Volume group "vg" successfully created

[0] fedora/~ # lvcreate -L100m vg /dev/sda
  Logical volume "lvol0" created.

[0] fedora/~ # lvcreate -L100m vg /dev/sdb
  Logical volume "lvol1" created.

[0] fedora/~ # pvchange --addtag mytag /dev/sda /dev/sdb
  Physical volume "/dev/sda" changed
  Physical volume "/dev/sdb" changed
  2 physical volumes changed / 0 physical volumes not changed

[0] fedora/~ # pvs -o+tags
  PV         VG     Fmt  Attr PSize   PFree   PV Tags
  /dev/sda   vg     lvm2 a--  124.00m  24.00m mytag  
  /dev/sdb   vg     lvm2 a--  124.00m  24.00m mytag  
  /dev/sdc   vg     lvm2 a--  124.00m 124.00m        
  /dev/sdd   vg     lvm2 a--  124.00m 124.00m        
  /dev/vda2  fedora lvm2 a--   19.49g      0       
  
[0] fedora/~ # lvs -o+devices
  LV    VG     Attr       LSize   Devices        
  root  fedora -wi-ao----  19.00g /dev/vda2(0)   
  swap  fedora -wi-ao---- 500.00m /dev/vda2(4864)
  lvol0 vg     -wi-a----- 100.00m /dev/sda(0)    
  lvol1 vg     -wi-a----- 100.00m /dev/sdb(0) 
   
[0] fedora/~ # pvmove @mytag
  Skipping locked LV lvol0
  All data on source PV skipped. It contains locked, hidden or non-top level LVs only.
  No data to move for vg

====

(with PVs that have no LV allocations)
[0] fedora/~ # vgcreate vg /dev/sda /dev/sdb /dev/sdc /dev/sdd
  Physical volume "/dev/sda" successfully created.
  Physical volume "/dev/sdb" successfully created.
  Physical volume "/dev/sdc" successfully created.
  Physical volume "/dev/sdd" successfully created.
  Volume group "vg" successfully created

[0] fedora/~ # pvchange --addtag mytag /dev/sda /dev/sdb
  Physical volume "/dev/sda" changed
  Physical volume "/dev/sdb" changed
  2 physical volumes changed / 0 physical volumes not changed

[0] fedora/~ # pvmove @mytag
  No data to move for vg
Segmentation fault (core dumped)

(...but if the tag points to one device, all is OK again)
[0] fedora/~ # pvchange --deltag mytag /dev/sdb
  Physical volume "/dev/sdb" changed
  1 physical volume changed / 0 physical volumes not changed

[0] fedora/~ # pvmove @mytag
  No data to move for vg

===

The segfault backtrace:

0x0000555555644973 in find_pvmove_lv (vg=0x5555559c3fd0, dev=0x5555559605f0, lv_type=8192) at metadata/mirror.c:1618
(gdb) bt
#0  0x0000555555644973 in find_pvmove_lv (vg=0x5555559c3fd0, dev=0x5555559605f0, lv_type=8192) at metadata/mirror.c:1618
#1  0x00005555555a58bd in _pvmove_setup_single (cmd=0x555555940030, vg=0x5555559c3fd0, pv=0x5555559c43d8, handle=0x555555982d48) at pvmove.c:661
#2  0x00005555555b4d86 in _process_pvs_in_vg (cmd=0x555555940030, vg=0x5555559c3fd0, all_devices=0x7fffffffe080, arg_devices=0x7fffffffe0b0, arg_tags=0x7fffffffe0d0, process_all_pvs=0, process_all_devices=0, skip=0,	handle=0x555555982d48, process_single_p
v=0x5555555a5621 <_pvmove_setup_single>) at toollib.c:3212
#3  0x00005555555b4ff8 in _process_pvs_in_vgs (cmd=0x555555940030, read_flags=1310720, all_vgnameids=0x7fffffffe090, all_devices=0x7fffffffe080, arg_devices=0x7fffffffe0b0, arg_tags=0x7fffffffe0d0, process_all_pvs=0, process_all_devices=0, handle=0x555555
982d48, process_single_pv=0x5555555a5621 <_pvmove_setup_single>) at toollib.c:3298
#4  0x00005555555b5508 in process_each_pv (cmd=0x555555940030, argc=1, argv=0x7fffffffe148, only_this_vgname=0x0, all_is_set=0, read_flags=1310720, handle=0x555555982d48, process_single_pv=0x5555555a5621 <_pvmove_setup_single>) at toollib.c:3420
#5  0x00005555555a63b2 in pvmove (cmd=0x555555940030, argc=0, argv=0x7fffffffe390) at pvmove.c:887
#6  0x000055555559cdcd in lvm_run_command (cmd=0x555555940030, argc=1, argv=0x7fffffffe388) at lvmcmdline.c:1706
#7  0x000055555559e17a in lvm2_main (argc=2, argv=0x7fffffffe380) at lvmcmdline.c:2175
#8  0x00005555555c5739 in main (argc=3,	argv=0x7fffffffe378) at lvm.c:22

Comment 1 David Teigland 2016-06-03 15:34:42 UTC
For the time being I've disabled tags with pvmove here:
https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=b321d2b1b9a3b6a1f8d67888a04c7318aa3148c2

Comment 2 David Teigland 2020-08-21 21:23:53 UTC
The pvmove command has not accepted tags for a long time, it doesn't seem necessary.


Note You need to log in before you can comment on or make changes to this bug.