Bug 172892

Summary: kernel dm: dm-ioctl memory leak on attempt to load non-existing mapping
Product: Red Hat Enterprise Linux 4 Reporter: David Milburn <dmilburn>
Component: kernelAssignee: Alasdair Kergon <agk>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: jbaron, tao
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHSA-2006-0132 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-03-07 20:40:14 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:
Bug Depends On:    
Bug Blocks: 168429    

Description David Milburn 2005-11-10 21:19:05 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.0.7-1.1.fc3 Firefox/1.0.7

Description of problem:
Customer found memory leak occurred when "dmsetup load" is executed for non-existing mapping.

Version-Release number of selected component (if applicable):
kernel-2.6.9-22.EL

How reproducible:
Always

Steps to Reproduce:
1. Run the dmsetup load command for non-existing map like below.
   # dmsetup remove foo
   # dd if=/dev/zero of=a bs=1M count=1
   # losetup /dev/loop7 a
   # while true; do echo "0 10 linear 7:7 0" | \
     dmsetup load foo >& /dev/null; done

2. Check the memory usage and the /var/log/messages.
  

Actual Results:  Memory usage will increase (about 3MB/s on my machine).
On IA-32, vmalloc area will soon become short (within about 1 minute)
and the following message will appear in the /var/log/messages:
--------------------------------------------------------------------
Nov  9 13:33:31 nec-em2 kernel: device-mapper: device doesn't appear to be in the dev hash table.
Nov  9 13:34:02 nec-em2 last message repeated 10360 times
Nov  9 13:34:10 nec-em2 kernel: allocation failed: out of vmalloc space - use vmalloc=<size> to increase size.
--------------------------------------------------------------------


Expected Results:  Memory shouldn't be leaked.


Additional info:

The following patch fixes this problem and it has been posted
to the upstream, accepted by Alasdair.

https://www.redhat.com/archives/dm-devel/2005-November/msg00066.html

Comment 1 Alasdair Kergon 2005-11-14 18:08:38 UTC
An error path in table_load() forgets to release a table that won't
now be referenced.


Comment 2 Alasdair Kergon 2005-11-14 18:11:48 UTC
dm-ioctl-missing-put-in-table-load-error-case.patch

Comment 8 Red Hat Bugzilla 2006-03-07 20:40:14 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2006-0132.html