1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 03:27:58 +03:00

pvremove: Update lvmcache => avoid spurious error messages.

This commit is contained in:
Petr Rockai 2014-06-08 22:57:04 +02:00
parent 02e1bf406b
commit ee200ddfc3
3 changed files with 24 additions and 3 deletions

View File

@ -1062,7 +1062,6 @@ static int _drop_vginfo(struct lvmcache_info *info, struct lvmcache_vginfo *vgin
return 1;
}
/* Unused
void lvmcache_del(struct lvmcache_info *info)
{
if (info->dev->pvid[0] && _pvid_hash)
@ -1071,11 +1070,11 @@ void lvmcache_del(struct lvmcache_info *info)
_drop_vginfo(info, info->vginfo);
info->label->labeller->ops->destroy_label(info->label->labeller,
info->label);
info->label);
dm_free(info);
return;
} */
}
static int _lvmcache_update_pvid(struct lvmcache_info *info, const char *pvid)
{

View File

@ -733,6 +733,7 @@ int pvremove_single(struct cmd_context *cmd, const char *pv_name,
unsigned prompt)
{
struct device *dev;
struct lvmcache_info *info;
int r = 0;
if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE, NULL)) {
@ -749,6 +750,8 @@ int pvremove_single(struct cmd_context *cmd, const char *pv_name,
goto out;
}
info = lvmcache_info_from_pvid(dev->pvid, 1);
if (!dev_test_excl(dev)) {
/* FIXME Detect whether device-mapper is still using the device */
log_error("Can't open %s exclusively - not removing. "
@ -762,6 +765,9 @@ int pvremove_single(struct cmd_context *cmd, const char *pv_name,
goto out;
}
if (info)
lvmcache_del(info);
if (!lvmetad_pv_gone_by_dev(dev, NULL))
goto_out;

View File

@ -0,0 +1,16 @@
# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
. lib/test
aux prepare_devs 2
pvcreate "$dev1" "$dev2"
pvremove "$dev1" "$dev2" 2>&1 | tee pvremove.txt
not grep "No physical" pvremove.txt