Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 4 product line. The current stable release is 4.9. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 144874

Summary: Attempting to take snapshot # 9 of an LV results in device mapper "Cannot allocate memory" and locks the original.
Product: Red Hat Enterprise Linux 4 Reporter: Mitchell Brandsma <mbrandsma>
Component: device-mapperAssignee: Alasdair Kergon <agk>
Status: CLOSED DUPLICATE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: ron.arts, ron.arts
Target Milestone: ---   
Target Release: ---   
Hardware: ia32e   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-02-21 19:07:52 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mitchell Brandsma 2005-01-12 08:42:29 UTC
Description of problem:

A volume group which I have converted from lvm1 to lvm2 causes 
problems when attempting to snapshot any logical volume for the 9th 
time.  Note that I can take many snapshots, but it appears shapshot 
number 9 of any LV causes the problem.

Either there is a coded limit of 8 snapshots, and the commands need 
to prevent attempt number 9, or there is a bug trying to take it.

The problem does not appear to be in any way hardware related.
Snapshot # 9 (/dev/rootvg/test9) does not appear.  I can still 
perform vg/lv operations, and can even perform an lvremove of the 
attempted snapshot # 9, but need to reboot to be able to 
access /dev/rootvg/tmp again.

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


How reproducible:

Every time



Steps to Reproduce:
1. Installed basic RH EL3 and upgraded to EL4 beta 2.  All lvm 
filesystems except /boot. (I believe it will happen from a fresh EL4 
install but we had issues with our install disk on the EM64T, so we 
installed EL3 and upgraded).
2. vgconvert -M 2 rootvg (I believe an install straight onto LVM2 
filesystems will also perform the same).
3. Snapshot one of the LVs 8 times...
4. Try to take snapshot # 9 of the same LV:
[root@el4beta test2]# lvcreate -s -L 1M -n test7 /dev/rootvg/tmp
  
Actual results:

Error trying to create snapshot 9:
  Rounding up size to full physical extent 16.00 MB
  device-mapper ioctl cmd 9 failed: Cannot allocate memory
  Couldn't load device 'rootvg-test4'.
  Problem reactivating origin tmp

Note that I was trying to create /dev/rootvg/test7 
(aka /dev/mapper/rootvg-test7) and it says it couldn't load device 
rootvg-test4 - that's not what I asked for!

At this point /tmp is locked and any attempts to access it or a 
mounted snapshot(ls, app uses a temp file, or whatever) are met by a 
system wait.  Other commands/functions as they should.


Expected results:

If this is a limitation (max 8 snapshots of any particular LV), the 
command should have refused politely.  Otherwise the device mapper 
should have created the rootvg-test7 snapshot.


Additional info:

 here is the order they were created in:
[root@el4beta ~]# lvcreate -s -L 1M -n test /dev/rootvg/tmp
  Rounding up size to full physical extent 16.00 MB
  Logical volume "test" created                               (# 1)
[root@el4beta ~]# lvcreate -s -L 1M -n test9 /dev/rootvg/tmp  
Rounding up size to full physical extent 16.00 MB
  Logical volume "test9" created                             (# 2)
[root@el4beta ~]# lvcreate -s -L 1M -n test1 /dev/rootvg/tmp  
Rounding up size to full physical extent 16.00 MB
  Logical volume "test1" created                             (# 3)

... snapshots 4-7 (test2-5) follow along the same lines, finally...

[root@el4beta test2]# lvcreate -s -L 1M -n test6 /dev/rootvg/tmp  
Rounding up size to full physical extent 16.00 MB
  Logical volume "test6" created                         **(# 8)

Comment 1 Alasdair Kergon 2005-01-12 14:02:34 UTC
Each snapshot requires a certain amount of (not-swappable) kernel
memory, and you've run out:-(

Work is underway to improve the way this situation is handled and to
increase the amount of memory available.


Comment 2 Alasdair Kergon 2005-01-12 14:04:21 UTC

*** This bug has been marked as a duplicate of 132057 ***

Comment 3 Mitchell Brandsma 2005-01-12 22:12:50 UTC
Hmmm, it must scale non-linearly.  I can happily take those first 8 
snapshots, then:
* Try to take one more snapshot, at which point it falls over, or
* Take another 4 snapshots of a different filesystem without any 
problems (number 5 of the second set fell over on the test I just did 
though).

I'll leave you all to it.

Comment 4 Red Hat Bugzilla 2006-02-21 19:07:52 UTC
Changed to 'CLOSED' state since 'RESOLVED' has been deprecated.