* [linux-lvm] issue (or bug): when vgremove does removing lvmcache
@ 2020-05-23 14:03 heming.zhao
2020-05-26 21:30 ` David Teigland
0 siblings, 1 reply; 3+ messages in thread
From: heming.zhao @ 2020-05-23 14:03 UTC (permalink / raw)
To: linux-lvm
Hello List,
when using below reproduced steps, lvm command show error info.
```
# pvcreate /dev/sda /dev/sdb
# vgcreate test /dev/sda /dev/sdb
# lvcreate --name main --size 200m test /dev/sda
# lvcreate --name fast --size 50m test /dev/sdb
# lvconvert -y --type cache --cachevol fast test/main
# lvs -a -o name,vgname,lvattr,origin,segtype,devices test
LV VG Attr Origin Type Devices
[fast] test Cwi-aoC--- linear /dev/sdb(0)
main test Cwi-a-C--- [main_corig] cache main_corig(0)
[main_corig] test owi-aoC--- linear /dev/sda(0)
# vgremove test --force
Logical volume "main" successfully removed
Assertion failed: can't _pv_write non-orphan PV (in VG )
Failed to remove physical volume "/dev/sdb" from volume group "test"
Volume group "test" not properly removed
# lvs # <== output none
# vgs # <== output none
# pvs
WARNING: PV /dev/sdb is marked in use but no VG was found using it.
WARNING: PV /dev/sdb might need repairing.
PV VG Fmt Attr PSize PFree
/dev/sda lvm2 --- 300.00m 300.00m
/dev/sdb [unknown] lvm2 u-- 300.00m 0
```
rootcause analysis:
1>
why output: Assertion failed: can't _pv_write non-orphan PV (in VG )
_vgremove_single
vg_remove
vg_remove_direct
pv_write(vg->cmd, pv, 0)
pv_write
if (!allow_non_orphan &&
(!is_orphan_vg(pv->vg_name) || pv->pe_alloc_count)) {
log_error("Assertion failed: can't _pv_write non-orphan PV "
"(in VG %s)", pv_vg_name(pv));
return 0;
}
the pv->pe_alloc_count is non-zero.
2>
why pv->pe_alloc_count is non-zero.
_vgremove_single
process_each_lv_in_vg
/*
* Only let hidden LVs through if --all was used or the LVs
* were specifically named on the command line.
*/
if (!lvargs_supplied && !lv_is_visible(lvl->lv) && !arg_is_set(cmd, all_ARG) &&
(!cmd->process_component_lvs || !lv_is_component(lvl->lv)))
continue;
cmd->process_component_lvs and lv_is_component(lvl->lv) are false,
then lv can't join in final_lvl and won't be removed later.
At last,
I can't find a good solution for this issue. the 112846ce0b01e5353 introduced this issue.
one solution maybe to add CACHE_POOL_METADATA in lv->status when _read_lvnames constructs lv.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [linux-lvm] issue (or bug): when vgremove does removing lvmcache
2020-05-23 14:03 [linux-lvm] issue (or bug): when vgremove does removing lvmcache heming.zhao
@ 2020-05-26 21:30 ` David Teigland
2020-05-27 2:57 ` heming.zhao
0 siblings, 1 reply; 3+ messages in thread
From: David Teigland @ 2020-05-26 21:30 UTC (permalink / raw)
To: heming.zhao; +Cc: linux-lvm
On Sat, May 23, 2020 at 10:03:50PM +0800, heming.zhao@suse.com wrote:
> # vgremove test --force
> Logical volume "main" successfully removed
> Assertion failed: can't _pv_write non-orphan PV (in VG )
> Failed to remove physical volume "/dev/sdb" from volume group "test"
> Volume group "test" not properly removed
That has been fixed, looks like 56aadd7fe2a1d24043ea9d06543c29317ac1cc58,
although that may have changed since.
Dave
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [linux-lvm] issue (or bug): when vgremove does removing lvmcache
2020-05-26 21:30 ` David Teigland
@ 2020-05-27 2:57 ` heming.zhao
0 siblings, 0 replies; 3+ messages in thread
From: heming.zhao @ 2020-05-27 2:57 UTC (permalink / raw)
To: David Teigland; +Cc: linux-lvm
Hello David,
very stupid mistake, I used master branch not not latest code to verify this issue.
after switching to latest code, this issue disappeared.
Thank you for your help.
On 5/27/20 5:30 AM, David Teigland wrote:
> On Sat, May 23, 2020 at 10:03:50PM +0800, heming.zhao@suse.com wrote:
>> # vgremove test --force
>> Logical volume "main" successfully removed
>> Assertion failed: can't _pv_write non-orphan PV (in VG )
>> Failed to remove physical volume "/dev/sdb" from volume group "test"
>> Volume group "test" not properly removed
>
> That has been fixed, looks like 56aadd7fe2a1d24043ea9d06543c29317ac1cc58,
> although that may have changed since.
> Dave
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-27 3:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-23 14:03 [linux-lvm] issue (or bug): when vgremove does removing lvmcache heming.zhao
2020-05-26 21:30 ` David Teigland
2020-05-27 2:57 ` heming.zhao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).