mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
coverity: extra check for find_pool_seg
find_pool_seg may return NULL in some internal error stats. Handle it explicitely.
This commit is contained in:
parent
b939ddf80c
commit
e9c60f874e
@ -1849,12 +1849,15 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume
|
||||
* However in case command would have crashed, such LV is
|
||||
* left unmonitored and may potentially require dmeventd.
|
||||
*/
|
||||
if ((lv_is_cache_pool_data(lv) || lv_is_cache_pool_metadata(lv)) &&
|
||||
!lv_is_used_cache_pool((find_pool_seg(first_seg(lv))->lv))) {
|
||||
log_debug_activation("Skipping %smonitor of %s.%s",
|
||||
(monitor) ? "" : "un", display_lvname(lv),
|
||||
(monitor) ? " Cache pool activation for clearing only." : "");
|
||||
return 1;
|
||||
if (lv_is_cache_pool_data(lv) || lv_is_cache_pool_metadata(lv)) {
|
||||
if (!(seg = find_pool_seg(first_seg(lv))))
|
||||
return_0;
|
||||
if (!lv_is_used_cache_pool(seg->lv)) {
|
||||
log_debug_activation("Skipping %smonitor of %s.%s",
|
||||
(monitor) ? "" : "un", display_lvname(lv),
|
||||
(monitor) ? " Cache pool activation for clearing only." : "");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -5288,6 +5288,8 @@ static int _lvresize_adjust_extents(struct logical_volume *lv,
|
||||
static int _lvresize_check_type(const struct logical_volume *lv,
|
||||
const struct lvresize_params *lp)
|
||||
{
|
||||
struct lv_segment *seg;
|
||||
|
||||
if (lv_is_origin(lv)) {
|
||||
if (lp->resize == LV_REDUCE) {
|
||||
log_error("Snapshot origin volumes cannot be reduced in size yet.");
|
||||
@ -5313,7 +5315,8 @@ static int _lvresize_check_type(const struct logical_volume *lv,
|
||||
}
|
||||
} else if (lp->resize == LV_EXTEND) {
|
||||
if (lv_is_thin_pool_metadata(lv) &&
|
||||
!thin_pool_feature_supported(find_pool_seg(first_seg(lv))->lv, THIN_FEATURE_METADATA_RESIZE)) {
|
||||
(!(seg = find_pool_seg(first_seg(lv))) ||
|
||||
!thin_pool_feature_supported(seg->lv, THIN_FEATURE_METADATA_RESIZE))) {
|
||||
log_error("Support for online metadata resize of %s not detected.",
|
||||
display_lvname(lv));
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user