diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2016-02-18 13:18:18 +0100 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2016-02-18 16:45:42 +0100 |
commit | 0358ca3aadaddd8ed60c817abb67ea38bf07a420 (patch) | |
tree | 7a63a3f6ac076f6168583f650b0578a06ba00ea7 /lib/thin | |
parent | 0fb3669d49040ea2e616491326eecad9926048c8 (diff) | |
download | lvm2-0358ca3aadaddd8ed60c817abb67ea38bf07a420.tar.gz |
thin: report PERCENT_INVALID for failed pool
When thin-pool is in failed/error state, we can't
read percentage so report invalid value.
Diffstat (limited to 'lib/thin')
-rw-r--r-- | lib/thin/thin.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/thin/thin.c b/lib/thin/thin.c index c9ee9f530..221ac48ce 100644 --- a/lib/thin/thin.c +++ b/lib/thin/thin.c @@ -404,8 +404,10 @@ static int _thin_pool_target_percent(void **target_state __attribute__((unused)) if (!dm_get_status_thin_pool(mem, params, &s)) return_0; + if (s->fail || s->error) + *percent = DM_PERCENT_INVALID; /* With 'seg' report metadata percent, otherwice data percent */ - if (seg) { + else if (seg) { *percent = dm_make_percent(s->used_metadata_blocks, s->total_metadata_blocks); *total_numerator += s->used_metadata_blocks; @@ -622,7 +624,9 @@ static int _thin_target_percent(void **target_state __attribute__((unused)), if (!dm_get_status_thin(mem, params, &s)) return_0; - if (seg) { + if (s->fail) + *percent = DM_PERCENT_INVALID; + else if (seg) { /* Pool allocates whole chunk so round-up to nearest one */ csize = first_seg(seg->pool_lv)->chunk_size; csize = ((seg->lv->size + csize - 1) / csize) * csize; |