If lv_info fails, don't report snapshot percentage
PATCH 1/1 If lv_info fails, don't report snapshot percentage
If lv_info fails, don't report snapshot percentage
We shouldn't report snapshot percentage if lv_info fails (i.e. returns zero) or if the device is not loaded (info.exists is zero).
Previously, the logic in the code was to not report percentage if lv_info succeeds and info.exists is zero.
This fixes a bug, when dm-mod is not loaded (and the kernel doesn't load it automatically) "lvs" commands reports all snapshots as 100% full.
Signed-off-by Mikulas Patocka <[email protected]>
--- lib/report/report.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/report/report.c +1 -1
@@ -1019,7 +1019,7 @@ static int _snpercent_disp(struct dm_rep }if ((!lv_is_cow (lv) && !lv_is_merging_origin (lv)) || - (lv_info (lv->vg->cmd, lv, &info,0 ,0 ) && !info.exists)) { + !lv_info (lv->vg->cmd, lv, &info,0 ,0 ) || !info.exists) { *sortval =UINT64_C (0 );dm_report_field_set_value (field,"" , sortval);return 1 ;
PATCH 1/1 If lv_info fails, don't report snapshot percentage
Quoted 1 line · Mikulas Patocka
If
lv_infofails, don't report snapshot percentage
Ack.
Alasdair