[lkml]   [2010]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH v2 3/3] NFS: Fix a memory leak in nfs_readdir
    On Wed, 1 Dec 2010 17:42:08 -0800 Linus Torvalds <> wrote:

    > On Wed, Dec 1, 2010 at 5:22 PM, Andrew Morton <> wrote:
    > >
    > > What we're talking about is races against memory reclaim, unmount, etc.
    > Ahh. Those I can believe in. Although I think they'd almost
    > incidentally be fixed by making inode freeing (which is where the
    > 'struct address_space' is embedded) RCU-safe, which we're going to do
    > anyway in 38. Then we could make the vmscan code just be a rcu-read
    > section.

    I didn't know that aspect of it. It will be nice to plug this race -
    it's been there for so long because nobody was able to think of an
    acceptable way of fixing it by direct means (synchronous locking,
    refcounting, etc). Taking a ref on the inode doesn't work, because we
    can't run iput_final() in direct-reclaim contexts (lock ordering snafus).

    vmscan is the problematic path - I _think_ all other code paths which
    remove pagecache have an inode ref. But this assumes that
    inode->i_mapping points at inode->i_data! Need to think about the
    situation where it points at a different inode's i_data - in that case
    these callers may have a ref on the wrong inode.

    > Of course, I do think the race is basically impossible to hit in
    > practice regardless.

    Actually I was able to hit the race back in late 2.5 or thereabouts.
    Really massive memory pressure caused vmscan->icache_shrinker to free
    the inode/address_space while another CPU in vmscan was playing with the
    address_space. That was quite a debugging session ;)

     \ /
      Last update: 2010-12-02 03:09    [W:0.038 / U:131.832 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site