Re: [PATCH v2 3/3] NFS: Fix a memory leak in nfs_readdir
From: Andrew Morton
Date: Wed Dec 01 2010 - 17:43:49 EST
On Thu, 2 Dec 2010 08:29:13 +1100
Neil Brown <neilb@xxxxxxx> wrote:
> > >
> > > However, while reading Documentation/filesystems/vfs.txt (in order to
> > > add documentation for freepage) I was surprised to read that the
> > > ->releasepage() is itself supposed to be allowed to actually remove the
> > > page from the address space if it so desires.
> >
> > That doesn't sound right. It came from Neil in 2006.
> >
> > Neil, what were you thinking there? Did you find such a ->releasepage()?
>
> Nope, no idea, sorry.
>
> No releasepage functions do anything like that, and no call sites suggest it
> could be a possibility. Quite the reverse - they are likely to remove the
> page from the mapping without checking that it is still in the mapping.
>
> So that sentence should be deleted.
This?
From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
->releasepage() does not remove the page from the mapping.
Cc: Neil Brown <neilb@xxxxxxx>
Cc: Trond Myklebust <Trond.Myklebust@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---
Documentation/filesystems/vfs.txt | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff -puN Documentation/filesystems/vfs.txt~documentation-filesystems-vfstxt-fix-repeasepage-description Documentation/filesystems/vfs.txt
--- a/Documentation/filesystems/vfs.txt~documentation-filesystems-vfstxt-fix-repeasepage-description
+++ a/Documentation/filesystems/vfs.txt
@@ -660,11 +660,10 @@ struct address_space_operations {
releasepage: releasepage is called on PagePrivate pages to indicate
that the page should be freed if possible. ->releasepage
should remove any private data from the page and clear the
- PagePrivate flag. It may also remove the page from the
- address_space. If this fails for some reason, it may indicate
- failure with a 0 return value.
- This is used in two distinct though related cases. The first
- is when the VM finds a clean page with no active users and
+ PagePrivate flag. If releasepage() fails for some reason, it must
+ indicate failure with a 0 return value.
+ releasepage() is used in two distinct though related cases. The
+ first is when the VM finds a clean page with no active users and
wants to make it a free page. If ->releasepage succeeds, the
page will be removed from the address_space and become free.
_
--
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/