Skip to contentSkip to conversation

cifs: fix page refcount leak

PATCH In review Jeff Layton 2 participants 2 messages May 25, 2010 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: fix page refcount leak

Commit 315e995c63a15cb4d4efdbfd70fe2db191917f7a is causing OOM kills when stress-testing a CIFS filesystem. The VFS readpages operation takes a page reference. The older code just handed this reference off to the page cache, but the new code takes an extra one. The simplest fix is to put the new reference after add_to_page_cache_lru.

---
 fs/cifs/file.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/cifs/file.c +1 -0
index 310533d..29ca398 100644
@@ -1919,6 +1919,7 @@ static void cifs_copy_cache_pages(struct address_space *mapping,
 			bytes_read -= PAGE_CACHE_SIZE;
 			continue;
 		}
+		page_cache_release(page);
 
 		target = kmap_atomic(page, KM_USER0);
 
Signature · 1 line
1.6.6.1
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Jeff Layton

Commit 315e995c63a15cb4d4efdbfd70fe2db191917f7a is causing OOM kills when stress-testing a CIFS filesystem. The VFS readpages operation takes a page reference. The older code just handed this reference off to the page cache, but the new code takes an extra one. The simplest fix is to put the new reference after add_to_page_cache_lru.

Quoted 18 lines
---
 fs/cifs/file.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/cifs/file.c +1 -0
index 310533d..29ca398 100644
@@ -1919,6 +1919,7 @@ static void cifs_copy_cache_pages(struct address_space *mapping,
 			bytes_read -= PAGE_CACHE_SIZE;
 			continue;
 		}
+		page_cache_release(page);
 
 		target = kmap_atomic(page, KM_USER0);
 
Signature · 1 line
1.6.6.1