1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-07 21:18:59 +03:00

lv_manip: add synchronizations

New udev in rawhide seems to be 'dropping' udev rule operations for devices
that are no longer existing - while this is 'probably' a bug - it's
revealing moments in lvm2 that likely should not run in a single
transaction and we should wait for a cookie before submitting more work.

TODO: it seem more 'error' paths should always include synchronization
before starting deactivating 'just activated' devices.
We should probably figure out some 'automatic' solution for this instead
of placing sync_local_dev_name() all over the place...
This commit is contained in:
Zdenek Kabelac 2019-08-26 13:28:17 +02:00
parent c98e34e4d0
commit 4b1dcc2eeb
4 changed files with 34 additions and 3 deletions

View File

@ -5830,9 +5830,17 @@ out:
ret = 1;
bad:
if (activated && !deactivate_lv(cmd, lock_lv)) {
log_error("Problem deactivating %s.", display_lvname(lock_lv));
ret = 0;
if (activated) {
if (!sync_local_dev_names(lock_lv->vg->cmd)) {
log_error("Failed to sync local devices before deactivating LV %s.",
display_lvname(lock_lv));
return 0;
}
if (!deactivate_lv(cmd, lock_lv)) {
log_error("Problem deactivating %s.", display_lvname(lock_lv));
ret = 0;
}
}
return ret;

View File

@ -292,6 +292,11 @@ int vg_remove_snapshot(struct logical_volume *cow)
if (is_origin_active &&
lv_is_virtual_origin(origin)) {
if (!sync_local_dev_names(origin->vg->cmd)) {
log_error("Failed to sync local devices before deactivating origin LV %s.",
display_lvname(origin));
return 0;
}
if (!deactivate_lv(origin->vg->cmd, origin)) {
log_error("Failed to deactivate logical volume \"%s\"",
origin->name);

View File

@ -529,6 +529,12 @@ int update_pool_lv(struct logical_volume *lv, int activate)
}
}
if (!sync_local_dev_names(lv->vg->cmd)) {
log_error("Failed to sync local devices LV %s.",
display_lvname(lv));
return 0;
}
if (activate &&
!deactivate_lv(lv->vg->cmd, lv)) {
log_error("Failed to deactivate %s.", display_lvname(lv));

View File

@ -2513,6 +2513,12 @@ static int _lvconvert_cache_repair(struct cmd_context *cmd,
/* TODO: any active validation of cache-pool metadata? */
deactivate_mlv:
if (!sync_local_dev_names(cmd)) {
log_error("Failed to sync local devices before deactivating LV %s.",
display_lvname(mlv));
return 0;
}
if (!deactivate_lv(cmd, mlv)) {
log_error("Cannot deactivate pool metadata volume %s.",
display_lvname(mlv));
@ -2520,6 +2526,12 @@ deactivate_mlv:
}
deactivate_pmslv:
if (!sync_local_dev_names(cmd)) {
log_error("Failed to sync local devices before deactivating LV %s.",
display_lvname(pmslv));
return 0;
}
if (!deactivate_lv(cmd, pmslv)) {
log_error("Cannot deactivate pool metadata spare volume %s.",
display_lvname(pmslv));