Bug 211335 - Missing page_cache_release() in do_direct_IO() causes memory leak.
Summary: Missing page_cache_release() in do_direct_IO() causes memory leak.
Status: CLOSED DUPLICATE of bug 191736
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: kernel
Version: 4.4
Hardware: All
OS: Linux
Target Milestone: ---
: ---
Assignee: Prarit Bhargava
QA Contact: Martin Jenner
Depends On:
TreeView+ depends on / blocked
Reported: 2006-10-18 18:33 UTC by Bob Miller
Modified: 2007-11-17 01:14 UTC (History)
3 users (show)

Clone Of:
Last Closed: 2007-06-28 14:19:44 UTC

Attachments (Terms of Use)
Patch for leaking io_direct_IO(). (508 bytes, patch)
2006-10-18 18:33 UTC, Bob Miller
no flags Details | Diff
test program (1.95 KB, text/plain)
2007-05-16 12:54 UTC, Radovan Augustin
no flags Details

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


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.


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

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

Note You need to log in before you can comment on or make changes to this bug.