]> sourceware.org Git - lvm2.git/commit
libdm: fix stats walk compatibility with older dmsetup
authorBryn M. Reeves <bmr@redhat.com>
Tue, 27 Sep 2016 13:35:22 +0000 (14:35 +0100)
committerBryn M. Reeves <bmr@redhat.com>
Tue, 27 Sep 2016 13:46:00 +0000 (14:46 +0100)
commit6ec8854fdb051b092d5e262dc6c6d4c2ea075cd1
tree74ec23e82ac98639b425f52f5235644ae6f13365
parent0a480c5c52bd34a1eb8337d59a7f4cc60317d2b1
libdm: fix stats walk compatibility with older dmsetup

The current dmsetup.c handles DR_STATS and DR_STATS_META reports
separately in _display_info_cols(), meaning that the stats walk
functions are never called for these report types.

Versions before v2.02.159 have a loop using dm_stats_walk_do() and
dm_stats_walk_while(), that executes once for non-stats reports,
and once per region, or area, for DR_STATS/DR_STATS_META reports.

This older behaviour relies on the documented behaviour that the
walk functions will accept a NULL pointer as the struct dm_stats*
argument.

This was broken by commit f1f2df7b: the NULL test on dms and
dms->regions were incorrectly moved from the dm_stats_walk_end()
wrapper to the internal '_stats_walk_end()' helper.

Since the pointer is dereferenced in between these points, using
an older dmsetup with current libdm results in a segfault when
running a non-stats report:

  # dmsetup info -c vg00/lvol0
  Segmentation fault (core dumped)

Restore the NULL checks to the wrapper function as intended.
WHATS_NEW_DM
libdm/libdm-stats.c
This page took 0.039066 seconds and 5 git commands to generate.