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 5 product line. The current stable release is 5.10. 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 493045

Summary: memory leak when reading from files mounted with nfs mount option 'noac'
Product: Red Hat Enterprise Linux 5 Reporter: Sachin Prabhu <sprabhu>
Component: kernelAssignee: Peter Staubach <staubach>
Status: CLOSED ERRATA QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 5.3CC: bdevouge, cward, dhoward, dzickus, jlayton, jpirko, jwest, steved, tao
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1065866 (view as bug list) Environment:
Last Closed: 2009-09-02 08:36:10 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: 588221, 1065866    
Attachments:
Description Flags
Proposed patch none

Description Sachin Prabhu 2009-03-31 12:50:10 UTC
When reading files from a share mounted with the noac option, the number of active nfs_read_data slabcache objects steadily increase and are never freed.

Reproducer:

We need 2 systems. A NFS server and a client. The nfs share exported by the nfs server is mounted on the client with the options 'noac'.

On a directory exported by the nfs server run the following command

while :;
     do dd if=/dev/zero of=.test bs=1M count=10;
     sleep 1;
     rm -f .test;
done

This command reads 10M of data from /dev/zero and copies it to .test. It sleeps for 1 second to allow the client to read .test before deleting it. It runs this in a loop.

On the NFS client, use one terminal to simply read this file in a loop with the following command

while :;
     do cat .test;
done

On another terminal, keep a check on nfs_read_data in /proc/slabinfo
watch grep nfs_read /proc/slabinfo

You should see the number of nfs_read_data active slabcache objects steadily increasing. These are not freed even when the share is unmounted.

On attempting to rmmod the nfs module, the kernel panics. I am not sure if this is however directly related to this memory leak issue.

Comment 1 Sachin Prabhu 2009-03-31 12:58:03 UTC
We do not see this memory leak when using attribute caching.

Comment 2 Peter Staubach 2009-04-02 19:43:55 UTC
Created attachment 337887 [details]
Proposed patch

The use of the "noac" mount option causes the NFS client to do synchronous
reads when reading a file.  As far as I can tell, this is only the way to
get the NFS client to do this.

Interestingly, the leak was in the normal, ie. read succeeded, path.  The
error path handled the memory correctly and freed it.  The normal path was
not freeing the allocated memory.

Comment 4 RHEL Program Management 2009-04-24 19:48:43 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 5 Don Zickus 2009-05-06 17:17:23 UTC
in kernel-2.6.18-144.el5
You can download this test kernel from http://people.redhat.com/dzickus/el5

Please do NOT transition this bugzilla state to VERIFIED until our QE team
has sent specific instructions indicating when to do so.  However feel free
to provide a comment indicating that this fix has been verified.

Comment 7 Chris Ward 2009-07-03 18:28:15 UTC
~~ Attention - RHEL 5.4 Beta Released! ~~

RHEL 5.4 Beta has been released! There should be a fix present in the Beta release that addresses this particular request. Please test and report back results here, at your earliest convenience. RHEL 5.4 General Availability release is just around the corner!

If you encounter any issues while testing Beta, please describe the issues you have encountered and set the bug into NEED_INFO. If you encounter new issues, please clone this bug to open a new issue and request it be reviewed for inclusion in RHEL 5.4 or a later update, if it is not of urgent severity.

Please do not flip the bug status to VERIFIED. Only post your verification results, and if available, update Verified field with the appropriate value.

Questions can be posted to this bug or your customer or partner representative.

Comment 10 errata-xmlrpc 2009-09-02 08:36:10 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 therefore 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-2009-1243.html