[v2,3/3] NFS: Fix a memory leak in nfs_readdir
diff mbox

Message ID AANLkTi=C8UtWwctEgBY2584d8fDV3OHpf+mGNnQO8ZJt@mail.gmail.com
State Superseded, archived
Delegated to: Trond Myklebust
Headers show

Commit Message

Linus Torvalds Dec. 1, 2010, 4:17 p.m. UTC
None

Patch
diff mbox

 include/linux/fs.h |    1 +
 mm/vmscan.c        |    3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index c9e06cc..090f0ea 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -602,6 +602,7 @@  struct address_space_operations {
 	sector_t (*bmap)(struct address_space *, sector_t);
 	void (*invalidatepage) (struct page *, unsigned long);
 	int (*releasepage) (struct page *, gfp_t);
+	void (*freepage)(struct page *);
 	ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
 			loff_t offset, unsigned long nr_segs);
 	int (*get_xip_mem)(struct address_space *, pgoff_t, int,
diff --git a/mm/vmscan.c b/mm/vmscan.c
index d31d7ce..1accb01 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -499,6 +499,9 @@  static int __remove_mapping(struct address_space *mapping, struct page *page)
 		mem_cgroup_uncharge_cache_page(page);
 	}
 
+	if (mapping->a_ops->freepage)
+		mapping->a_ops->freepage(page);
+
 	return 1;
 
 cannot_free: