Hide Forgot
Description of problem: In RHEL6, the lvm2 tool was modified so that it calculates maximum space that a snapshot could use and restricts the user-supplied snapshot size so that it is never larger than the maximum useable space. However, this calculation is incorrect. Under certain circumstances lvm2 may allocate snapshot that is too small. When this snapshot is filled up, it overflows and all data in the snapshot is lost. Version-Release number of selected component (if applicable): 2.02.100(2)-RHEL6 (2013-10-23) How reproducible: Always Steps to Reproduce: Use this script. Set the variable VG to some real volume group. The volume group must have extent size 4MiB or less (by default, extent size is 4MiB) and it must have at least 4GiB free space. #!/bin/sh VG=vg1 lvremove -f $VG/origin set -e lvcreate -L 2143289344b -n origin $VG lvcreate -n snap -c 8k -L 2304M -s $VG/origin dd if=/dev/zero of=/dev/$VG/snap bs=1M oflag=direct Actual results: The snapshot overflows and all data in it is lost. Expected results: The snapshot should not overflow. The user specified sufficient size (2304MiB), but lvm2 trimmed the size to a smaller value. Additional info: See the bug report at http://www.redhat.com/archives/dm-devel/2013-November/msg00153.html
Upstreamed updated version of Mikulas' patch: http://www.redhat.com/archives/lvm-devel/2014-February/msg00161.html
Upstream test case: https://www.redhat.com/archives/lvm-devel/2014-March/msg00045.html
Ran 5 iteration of aforementioned test without issues: ============================================================ Iteration 5 of 5 started at Mon Jun 30 13:43:47 CEST 2014 ============================================================ SCENARIO - [calc_maximum_usable_space] Making origin volume lvcreate -n origin -L 2143289344b snapper Creating snap requiring LVM to recaluculate its total space lvcreate -n calc_snap -c 8k -L 2304M -s /dev/snapper/origin Attempting to fill snap dd if=/dev/zero of=/dev/snapper/calc_snap bs=1M oflag=direct dd: writing `/dev/snapper/calc_snap': No space left on device 2045+0 records in 2044+0 records out 2143289344 bytes (2.1 GB) copied, 33.7317 s, 63.5 MB/s Read from snap 100+0 records in 100+0 records out 104857600 bytes (105 MB) copied, 1.22551 s, 85.6 MB/s current snap attr: swi-a-s--- Removing volume snapper/calc_snap Removing origin snapper/origin Deleting VG snapper Deleting PVs /dev/sdb1 /dev/sdc1 Marking VERIFIED with: lvm2-2.02.107-1.el6 BUILT: Mon Jun 23 16:44:45 CEST 2014 lvm2-libs-2.02.107-1.el6 BUILT: Mon Jun 23 16:44:45 CEST 2014 lvm2-cluster-2.02.107-1.el6 BUILT: Mon Jun 23 16:44:45 CEST 2014 udev-147-2.55.el6 BUILT: Wed Jun 18 13:30:21 CEST 2014 device-mapper-1.02.86-1.el6 BUILT: Mon Jun 23 16:44:45 CEST 2014 device-mapper-libs-1.02.86-1.el6 BUILT: Mon Jun 23 16:44:45 CEST 2014 device-mapper-event-1.02.86-1.el6 BUILT: Mon Jun 23 16:44:45 CEST 2014 device-mapper-event-libs-1.02.86-1.el6 BUILT: Mon Jun 23 16:44:45 CEST 2014 device-mapper-persistent-data-0.3.2-1.el6 BUILT: Fri Apr 4 15:43:06 CEST 2014 cmirror-2.02.107-1.el6 BUILT: Mon Jun 23 16:44:45 CEST 2014
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. http://rhn.redhat.com/errata/RHBA-2014-1387.html