Bug 861843 - lvm2app value = lvm_lv_get_property(lvmLV, "snap_percent") segfaults on thin snapshots
lvm2app value = lvm_lv_get_property(lvmLV, "snap_percent") segfaults on thin...
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: lvm2 (Show other bugs)
Unspecified Unspecified
high Severity unspecified
: rc
: ---
Assigned To: Zdenek Kabelac
Cluster QE
Depends On:
  Show dependency treegraph
Reported: 2012-10-01 01:40 EDT by benscott
Modified: 2013-02-21 03:14 EST (History)
11 users (show)

See Also:
Fixed In Version: lvm2-2.02.98-1.el6
Doc Type: Enhancement
Doc Text:
Feature: The lvm2app library now reports the data_percent field which indicates how full snapshots, thin pools and volumes are. (The Logical Volume needs to be active to obtain this information.) Reason: Thin snapshots have a new different way of reporting its usage.
Story Points: ---
Clone Of:
Last Closed: 2013-02-21 03:14:06 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description benscott 2012-10-01 01:40:23 EDT
Description of problem:

When using liblvm2app on a thin snapshot
the following code causes a segfault:

value = lvm_lv_get_property(lvmLV, "snap_percent"); 

Version-Release number of selected component (if applicable):

  LVM version:     2.02.98(2)-git (2012-08-24)
  Library version: 1.02.77-git (2012-08-24)
  Driver version:  4.22.0
Comment 2 Zdenek Kabelac 2012-10-08 07:58:06 EDT
Fix upstream  (avoid detecting snap_percent on non-snap volume)


NB:  thin snapshot doesn't have  'snap_percent' property - only 'data_percent' since thin_pool shares all the space between all its volume. Thus you could only obtain value of 'mapped' spaces (just like with any other thin volume).
Comment 4 Zdenek Kabelac 2012-10-12 05:24:34 EDT
Here is simple    lvm2api test program which should pass now:

# Create pool & thin & snap LVs

lvcreate -L5M -T vg/pool
lvcreate -V1M -T vg/pool -n thin
lvcreate -s vg/thin -n snap

#include "lvm2app.h"

int main(int argc, char *argv[])
	lvm_t handle;
	vg_t vg;
	lv_t lv;
	struct lvm_property_value v;

	handle = lvm_init(NULL);
	vg = lvm_vg_open(handle, argv[1], "r", 0);
	lv = lvm_lv_from_name(vg, "snap");
	v = lvm_lv_get_property(lv, "snap_percent");


	return 0;
Comment 7 Corey Marthaler 2013-01-02 19:09:13 EST
Marking verified (Sanity Only), as snapshot testing of thin volumes is pretty solid in the latest rpms.

lvm2-2.02.98-6.el6    BUILT: Thu Dec 20 07:00:04 CST 2012
lvm2-libs-2.02.98-6.el6    BUILT: Thu Dec 20 07:00:04 CST 2012
lvm2-cluster-2.02.98-6.el6    BUILT: Thu Dec 20 07:00:04 CST 2012
udev-147-2.43.el6    BUILT: Thu Oct 11 05:59:38 CDT 2012
device-mapper-1.02.77-6.el6    BUILT: Thu Dec 20 07:00:04 CST 2012
device-mapper-libs-1.02.77-6.el6    BUILT: Thu Dec 20 07:00:04 CST 2012
device-mapper-event-1.02.77-6.el6    BUILT: Thu Dec 20 07:00:04 CST 2012
device-mapper-event-libs-1.02.77-6.el6    BUILT: Thu Dec 20 07:00:04 CST 2012
cmirror-2.02.98-6.el6    BUILT: Thu Dec 20 07:00:04 CST 2012
Comment 8 errata-xmlrpc 2013-02-21 03:14:06 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.