Bug 857555 - nfs: fix potential slabcache leaks when cache allocations fail
nfs: fix potential slabcache leaks when cache allocations fail
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: kernel (Show other bugs)
6.4
Unspecified Unspecified
unspecified Severity medium
: rc
: ---
Assigned To: Steve Dickson
Petr Beňas
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-14 15:57 EDT by Jeff Layton
Modified: 2015-01-04 18:03 EST (History)
8 users (show)

See Also:
Fixed In Version: kernel-2.6.32-335.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-02-21 01:37:44 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jeff Layton 2012-09-14 15:57:07 EDT
I recently pushed this patch upstream:

commit 3dd4765fce04c0b4af1e0bc4c0b10f906f95fabc
Author: Jeff Layton <jlayton@redhat.com>
Date:   Thu Aug 2 14:30:56 2012 -0400

    nfs: tear down caches in nfs_init_writepagecache when allocation fails

...which I think we'll want in rhel6. Ideally Steve D can just pull it in as part of his pnfs DIO backport, but opening this bug to make sure it doesn't fall through the cracks.
Comment 2 RHEL Product and Program Management 2012-09-14 16:30:48 EDT
This request was evaluated by Red Hat Product Management for
inclusion in a Red Hat Enterprise Linux release.  Product
Management has requested further review of this request by
Red Hat Engineering, for potential inclusion in a Red Hat
Enterprise Linux release for currently deployed products.
This request is not yet committed for inclusion in a release.
Comment 4 yanfu,wang 2012-09-16 22:41:50 EDT
hi Jeff,
Do you know any test steps/reproducer QE could use to test the patch?
Thanks in advance.
Comment 5 Jeff Layton 2012-09-17 09:13:48 EDT
No. There are 2 bugs at play here and only one is easily reproducible...

The first problem is that when allocating any of the caches fails, the nfs code doesn't clean up any that were already allocated. That's a long standing bug that we ought to fix, but that will be hard to reproduce without adding some sort of fault injection.

The second problem is that we don't ever clean up the nfs_commit_data cache. This is easier to reproduce, but that bug is introduced in one of steved's pnfs "waves". No released kernel contains that bug (yet).

Most likely steve should just take the patch I sent upstream into his pnfs waves and close this bug as a dup.
Comment 6 yanfu,wang 2012-09-18 01:48:03 EDT
(In reply to comment #5)
> No. There are 2 bugs at play here and only one is easily reproducible...
> 
> The first problem is that when allocating any of the caches fails, the nfs
> code doesn't clean up any that were already allocated. That's a long
> standing bug that we ought to fix, but that will be hard to reproduce
> without adding some sort of fault injection.
> 
> The second problem is that we don't ever clean up the nfs_commit_data cache.
> This is easier to reproduce, but that bug is introduced in one of steved's
> pnfs "waves". No released kernel contains that bug (yet).
hi Jeff,
Thanks for your useful info.
As per the second problem you mentioned above, could you tell me how do I know the nfs_commit_data cache cleaned up when uploading nfs module? QE could cover this at least, thanks.
Comment 7 yanfu,wang 2012-09-18 01:49:52 EDT
(In reply to comment #6)
> (In reply to comment #5)
> > No. There are 2 bugs at play here and only one is easily reproducible...
> > 
> > The first problem is that when allocating any of the caches fails, the nfs
> > code doesn't clean up any that were already allocated. That's a long
> > standing bug that we ought to fix, but that will be hard to reproduce
> > without adding some sort of fault injection.
> > 
> > The second problem is that we don't ever clean up the nfs_commit_data cache.
> > This is easier to reproduce, but that bug is introduced in one of steved's
> > pnfs "waves". No released kernel contains that bug (yet).
> hi Jeff,
> Thanks for your useful info.
> As per the second problem you mentioned above, could you tell me how do I
> know the nfs_commit_data cache cleaned up when uploading nfs module? QE
> could cover this at least, thanks.
sorry, s/uploading/unloading/
Comment 8 Jeff Layton 2012-09-18 08:51:25 EDT
$ grep nfs_commit_data /proc/slabinfo

If that cache no longer exists after unloading the module then things are working correctly.
Comment 9 yanfu,wang 2012-09-18 22:57:33 EDT
(In reply to comment #8)
> $ grep nfs_commit_data /proc/slabinfo
> 
> If that cache no longer exists after unloading the module then things are
> working correctly.

Thank you, Jeff!
QE could write test case to cover this.
Comment 10 Jeff Layton 2012-09-25 14:22:30 EDT
Actually...I found that I could oops the kernel pretty trivially with steved's backport that didn't have this patch:

# modprobe nfs
# rmmod nfs
# cat /proc/slabinfo

...and boom, it oopses because the string describing the slabcache lives inside of nfs.ko. Once you rmmod, that pointer is no longer good. Adding the above patch fixes the issue.
Comment 12 Jarod Wilson 2012-10-19 16:51:33 EDT
Patch(es) available on kernel-2.6.32-335.el6
Comment 16 Petr Beňas 2012-10-24 09:58:00 EDT
Reproduced in 2.6.32-330.el6.x86_64 and verified in 2.6.32-331.el6.x86_64.
Comment 18 errata-xmlrpc 2013-02-21 01:37:44 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2013-0496.html

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