Re: [PATCH 165/173] ramfs: fix memleak on no-mmu arch

From: Willy Tarreau
Date: Tue Apr 26 2011 - 01:02:50 EST


On Mon, Apr 25, 2011 at 05:37:19PM -0700, Hugh Dickins wrote:
(...)
> > fs/ramfs/file-nommu.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > --- a/fs/ramfs/file-nommu.c
> > +++ b/fs/ramfs/file-nommu.c
> > @@ -111,6 +111,7 @@ int ramfs_nommu_expand_for_mapping(struc
> > SetPageDirty(page);
> >
> > unlock_page(page);
> > + put_page(page);
> > }
> >
> > return 0;
>
>
> I'm not absolutely certain, but I rather think this patch should NOT
> be included: I never looked to see when the bug it fixes crept in,
> but now I'm thinking it may have been 2678958e1225 "ramfs-nommu:
> use generic lru cache", which did not go in until 2.6.30 -
> __lru_cache_add adding the unbalanced page_cache_get.

OK.

> Whereas the "SetPageDirty" you can see above is not in 2.6.27.59-rc1:

Ah indeed you're right !

> I think you'd do well to include the patch below which introduced it.
> (It may give you a reject because __pagevec_lru_add was enhanced to
> __pagevec_lru_add_file by the time that patch went in.)
>
> Yes, the pages Enrik reports as being wrongly discarded, would not
> have been discarded if their reference counts were too high:
> I do believe you need Enrik's patch instead of Bob's patch.

Fine, I will do that then.
Thank you Hugh for the detailed explanation !

Willy

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/