lkml.org 
[lkml]   [2010]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v2 3/3] NFS: Fix a memory leak in nfs_readdir
    On Wed, 1 Dec 2010, Linus Torvalds wrote:
    > On Wed, Dec 1, 2010 at 2:13 PM, Andrew Morton <akpm@linux-foundation.org> wrote:
    > > On Wed, 01 Dec 2010 16:51:12 -0500
    > > Trond Myklebust <Trond.Myklebust@netapp.com> wrote:
    > >
    > >> On Wed, 2010-12-01 at 13:38 -0800, Andrew Morton wrote:
    > >> > Probably on most call paths we'll be OK - if a process is in the middle
    > >> > of a file truncate, holdin a file* ref which holds an inode ref then
    > >> > nobody will be unmounting that fs and hence nobody will be unloading
    > >> > that module.
    > >> >
    > >> > However on the random_code->alloc_page->vmscan->releasepage path, none
    > >> > of that applies.
    > >>
    > >> Just out of interest, what ensures that the mapping is still around for
    > >> the 'spin_unlock_irq(&mapping->tree_lock);' in __remove_mapping()?
    > >
    > > Nothing, afacit.
    >
    > No, we're good.
    >
    > Module unload has to go through a "stop_machine()" cycle, and that in
    > turn requires an idle period for everything. And just a preemption
    > reschedule isn't enough for that.
    >
    > So what is sufficient is that
    >
    > - we had the page locked and on the mapping
    >
    > This implies that we had an inode reference to the module, and the
    > page lock means that the inode reference cannot go away (because it
    > will involve invalidate-pages etc)

    I'm not so sure of that: doesn't it test inode->i_data.nrpages in
    various places, and skip ahead if that is already 0? I don't see
    the necessary serialization when nrpages comes down to 0.

    >
    > - we're not sleeping after __remove_mapping, so unload can't happen afterwards.
    >
    > A _lot_ of the module races depend on that latter thing. We have
    > almost no cases that are strictly about actual reference counts etc.

    Okay, I'm reassured on my module unload point; but not on the
    question of safety of spin_unlock_irq(&mapping->tree_lock)
    which Trond lobbed back in return.

    Hugh


    \
     
     \ /
      Last update: 2010-12-01 23:47    [W:3.255 / U:0.072 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site