Bug 861843 - lvm2app value = lvm_lv_get_property(lvmLV, "snap_percent") segfaults on thin snapshots
Summary: lvm2app value = lvm_lv_get_property(lvmLV, "snap_percent") segfaults on thin...
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: lvm2
Version: 6.5
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Zdenek Kabelac
QA Contact: Cluster QE
Depends On:
TreeView+ depends on / blocked
Reported: 2012-10-01 05:40 UTC by benscott
Modified: 2013-02-21 08:14 UTC (History)
11 users (show)

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.
Clone Of:
Last Closed: 2013-02-21 08:14:06 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0501 normal SHIPPED_LIVE lvm2 bug fix and enhancement update 2013-02-20 21:30:45 UTC

Description benscott 2012-10-01 05:40:23 UTC
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 11:58:06 UTC
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 09:24:34 UTC
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-03 00:09:13 UTC
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 08:14:06 UTC
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.