1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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 <mingnus gmail com
This commit is contained in:
Zdenek Kabelac 2016-03-30 10:16:41 +02:00
parent fe7ae37f5e
commit 8bbec41bd4
2 changed files with 6 additions and 6 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.149 - Version 2.02.149 -
================================== ==================================
Do not flush thin-pool when checking metadata fullness.
Remove spurious error about no value in /sys/dev/block/major:minor/dm/uuid. Remove spurious error about no value in /sys/dev/block/major:minor/dm/uuid.
Fix device mismatch detection for LV if persistent .cache file is used. Fix device mismatch detection for LV if persistent .cache file is used.
Fix holder device not being found in /dev while sysfs has it during dev scan. Fix holder device not being found in /dev while sysfs has it during dev scan.

View File

@ -884,20 +884,22 @@ static int _percent_run(struct dev_manager *dm, const char *name,
char *params = NULL; char *params = NULL;
const struct dm_list *segh = lv ? &lv->segments : NULL; const struct dm_list *segh = lv ? &lv->segments : NULL;
struct lv_segment *seg = NULL; struct lv_segment *seg = NULL;
struct segment_type *segtype;
int first_time = 1; int first_time = 1;
dm_percent_t percent = DM_PERCENT_INVALID; dm_percent_t percent = DM_PERCENT_INVALID;
uint64_t total_numerator = 0, total_denominator = 0; uint64_t total_numerator = 0, total_denominator = 0;
struct segment_type *segtype;
*overall_percent = percent; *overall_percent = percent;
if (!(segtype = get_segtype_from_string(dm->cmd, target_type)))
return_0;
if (!(dmt = _setup_task(name, dlid, event_nr, if (!(dmt = _setup_task(name, dlid, event_nr,
wait ? DM_DEVICE_WAITEVENT : DM_DEVICE_STATUS, 0, 0, 0))) wait ? DM_DEVICE_WAITEVENT : DM_DEVICE_STATUS, 0, 0, 0)))
return_0; return_0;
/* No freeze on overfilled thin-pool, read existing slightly outdated data */ /* 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)) !dm_task_no_flush(dmt))
log_warn("Can't set no_flush flag."); /* Non fatal */ 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) if (!type || !params)
continue; continue;
if (!(segtype = get_segtype_from_string(dm->cmd, target_type)))
continue;
if (strcmp(type, target_type)) { if (strcmp(type, target_type)) {
/* If kernel's type isn't an exact match is it compatible? */ /* If kernel's type isn't an exact match is it compatible? */
if (!segtype->ops->target_status_compatible || if (!segtype->ops->target_status_compatible ||