Bug 211335

Summary: Missing page_cache_release() in do_direct_IO() causes memory leak.
Product: Red Hat Enterprise Linux 4 Reporter: Bob Miller <rem>
Component: kernelAssignee: Prarit Bhargava <prarit>
Status: CLOSED DUPLICATE QA Contact: Martin Jenner <mjenner>
Severity: high Docs Contact:
Priority: medium    
Version: 4.4CC: peterm, prarit, sysadmin
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-06-28 14:19:44 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:
Attachments:
Description Flags
Patch for leaking io_direct_IO().
none
test program none

Description Bob Miller 2006-10-18 18:33:10 UTC
Description of problem:

In do_direct_IO() there is an error return path if the buffer is not mapped 
and it is a write operation.  In that case, the current code just returns 
-ENOTBLK.  The code should be calling page_cache_release(page) before the 
return.  Because of the bug the page reference count for the page will never  
become zero and the page will never be free'd.  Enough of this and your system 
runs out of memory.

How reproducible:

If you do lots of direct I/O writes with the system under memory pressure this 
can happen a lot.

Comment 1 Bob Miller 2006-10-18 18:33:10 UTC
Created attachment 138819 [details]
Patch for leaking io_direct_IO().

Comment 3 Alex Yamauchi 2007-05-15 02:19:44 UTC
I believe I may have systems affected by this issue.  Has there been any
resoution?  My WS4U5 workstations are getting stuck in swap and it takes forever
to clear.

Would you please provide some tests to verify whether or not I am experiencing
the same issue?

Comment 4 Radovan Augustin 2007-05-16 12:54:40 UTC
Created attachment 154814 [details]
test program

Hi,

here is test, which is able to test this bug. If you will have difference in
memory ussage before and after test run, you have a bug. Test will loose 100 MB
of system memory. If you are using RHEL 4.4, patch for this bug is already
included in RHEL updates.

Comment 7 Prarit Bhargava 2007-06-28 14:12:05 UTC
This seems pretty straightforward and is a bug.  Upstream code matches the
proposed patch.

I'll build & test.

P.

Comment 8 Prarit Bhargava 2007-06-28 14:19:44 UTC

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