From 8bbec41bd482175ee61478bef65cc58c7e814abf Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Wed, 30 Mar 2016 10:16:41 +0200 Subject: [PATCH] thin: no thin-pool flush when reading metadata status Previous fix missed the fact the we do query for 'percent' with seg value either set or unset (API overload...) When 'seg' was unset, we still issue flush with status. Fix it by cheking segtype by target_type. As we check for segtype - we could also skip whole percentage if the 'segtype' is unknown by code directly. Reported-by: Ming-Hung Tsai segments : NULL; struct lv_segment *seg = NULL; - struct segment_type *segtype; int first_time = 1; dm_percent_t percent = DM_PERCENT_INVALID; - uint64_t total_numerator = 0, total_denominator = 0; + struct segment_type *segtype; *overall_percent = percent; + if (!(segtype = get_segtype_from_string(dm->cmd, target_type))) + return_0; + if (!(dmt = _setup_task(name, dlid, event_nr, wait ? DM_DEVICE_WAITEVENT : DM_DEVICE_STATUS, 0, 0, 0))) return_0; /* No freeze on overfilled thin-pool, read existing slightly outdated data */ - if (lv && lv_is_thin_pool(lv) && + if (segtype_is_thin(segtype) && !dm_task_no_flush(dmt)) log_warn("Can't set no_flush flag."); /* Non fatal */ @@ -926,9 +928,6 @@ static int _percent_run(struct dev_manager *dm, const char *name, if (!type || !params) continue; - if (!(segtype = get_segtype_from_string(dm->cmd, target_type))) - continue; - if (strcmp(type, target_type)) { /* If kernel's type isn't an exact match is it compatible? */ if (!segtype->ops->target_status_compatible ||