mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
cache: add log_error on error path
Validate and report error when lv_cache_status is called for inactive LV, or pending delete or unused cache_pool.
This commit is contained in:
parent
ecfb90de74
commit
04003cf1ff
@ -1131,19 +1131,29 @@ int lv_cache_status(const struct logical_volume *cache_lv,
|
|||||||
struct dev_manager *dm;
|
struct dev_manager *dm;
|
||||||
struct lv_segment *cache_seg;
|
struct lv_segment *cache_seg;
|
||||||
|
|
||||||
if (lv_is_cache_pool(cache_lv) && !dm_list_empty(&cache_lv->segs_using_this_lv)) {
|
if (lv_is_cache_pool(cache_lv)) {
|
||||||
if (!(cache_seg = get_only_segment_using_this_lv(cache_lv)))
|
if (dm_list_empty(&cache_lv->segs_using_this_lv) ||
|
||||||
return_0;
|
!(cache_seg = get_only_segment_using_this_lv(cache_lv))) {
|
||||||
|
log_error(INTERNAL_ERROR "Cannot check status for unused cache pool %s.",
|
||||||
|
display_lvname(cache_lv));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
cache_lv = cache_seg->lv;
|
cache_lv = cache_seg->lv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lv_is_pending_delete(cache_lv))
|
if (lv_is_pending_delete(cache_lv)) {
|
||||||
|
log_error("Cannot check status for deleted cache volume %s.",
|
||||||
|
display_lvname(cache_lv));
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!lv_info(cache_lv->vg->cmd, cache_lv, 0, NULL, 0, 0))
|
if (!lv_info(cache_lv->vg->cmd, cache_lv, 0, NULL, 0, 0)) {
|
||||||
|
log_error("Cannot check status for locally inactive cache volume %s.",
|
||||||
|
display_lvname(cache_lv));
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
log_debug_activation("Checking cache status for LV %s.",
|
log_debug_activation("Checking status for cache volume %s.",
|
||||||
display_lvname(cache_lv));
|
display_lvname(cache_lv));
|
||||||
|
|
||||||
if (!(dm = dev_manager_create(cache_lv->vg->cmd, cache_lv->vg->name, 1)))
|
if (!(dm = dev_manager_create(cache_lv->vg->cmd, cache_lv->vg->name, 1)))
|
||||||
|
@ -702,7 +702,8 @@ static int _lvchange_cache(struct cmd_context *cmd, struct logical_volume *lv)
|
|||||||
goto_out;
|
goto_out;
|
||||||
|
|
||||||
if ((mode != CACHE_MODE_UNDEFINED) &&
|
if ((mode != CACHE_MODE_UNDEFINED) &&
|
||||||
(mode != pool_seg->cache_mode)) {
|
(mode != pool_seg->cache_mode) &&
|
||||||
|
lv_is_cache(lv)) {
|
||||||
if (!lv_cache_wait_for_clean(lv, &is_clean))
|
if (!lv_cache_wait_for_clean(lv, &is_clean))
|
||||||
return_0;
|
return_0;
|
||||||
if (!is_clean) {
|
if (!is_clean) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user