diff --git a/lib/activate/activate.c b/lib/activate/activate.c index b3ed5131a..d73e8b12f 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -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; + } } /* diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 1a584f224..f75cf515c 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -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;