1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

pvremove: make sure even invalid info is removed from lvmcache on pvremove

The lvmcache info might be resued, most notably in lvm shell.
We need to be sure that even lvmcache_info marked as invalid
is removed from the lvmcache so it does not confuse any subsequent
code/commands executed later on.

Problematic example with the lvm shell:

lvm> pvs
  PV         VG   Fmt  Attr PSize   PFree
  /dev/sda        lvm2 ---  128.00m 128.00m

Before this patch (/dev/sda still displayed in a way):
======================================================

lvm> pvremove /dev/sda
  Labels on physical volume "/dev/sda" successfully wiped

(without lvmetad)
lvm> pvs
  No physical volume label read from /dev/sda

(with lvmetad)
lvm> pvs
  PV         VG   Fmt  Attr PSize   PFree
  /dev/sda        lvm2 ---  128.00m 128.00m

With this patch applied:
========================

lvm> pvremove /dev/sda
  Labels on physical volume "/dev/sda" successfully wiped

(without lvmetad)
lvm> pvs

(with lvmetad)
lvm> pvs
This commit is contained in:
Peter Rajnoha 2015-10-23 14:11:16 +02:00
parent 1a7bea0f0f
commit 8b965bd3d5
2 changed files with 2 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.133 - Version 2.02.133 -
====================================== ======================================
Fix lvmcache to not cache even invalid info about PV which got removed.
Support checking of memlock daemon counter. Support checking of memlock daemon counter.
Allow all log levels to be used with the lvmetad -l option. Allow all log levels to be used with the lvmetad -l option.
Add optional shutdown when idle support for lvmetad. Add optional shutdown when idle support for lvmetad.

View File

@ -781,7 +781,7 @@ int pvremove_single(struct cmd_context *cmd, const char *pv_name,
goto out; goto out;
} }
info = lvmcache_info_from_pvid(dev->pvid, 1); info = lvmcache_info_from_pvid(dev->pvid, 0);
if (!dev_test_excl(dev)) { if (!dev_test_excl(dev)) {
/* FIXME Detect whether device-mapper is still using the device */ /* FIXME Detect whether device-mapper is still using the device */