浏览代码

[CIFS] Fix cifs update of page cache. Write at correct offset when out of memory
and add_to_page_cache fails.

Thanks to Shaggy for pointing out the fix.

Signed-off-by: Steve French (sfrench@us.ibm.com)
Signed-off-by: Shaggy (shaggy@us.ibm.com)

Steve French 20 年之前
父节点
当前提交
3079ca621e
共有 2 个文件被更改,包括 4 次插入1 次删除
  1. 2 1
      fs/cifs/CHANGES
  2. 2 0
      fs/cifs/file.c

+ 2 - 1
fs/cifs/CHANGES

@@ -6,7 +6,8 @@ kills the cifsd thread (NB: killing the cifs kernel threads is not
 recommended, unmount and rmmod cifs will kill them when they are
 no longer needed).  Fix readdir to ASCII servers (ie older servers
 which do not support Unicode) and also require asterik.
-
+Fix out of memory case in which data could be written one page
+off in the page cache.
 
 Version 1.33
 ------------

+ 2 - 0
fs/cifs/file.c

@@ -1352,6 +1352,8 @@ static void cifs_copy_cache_pages(struct address_space *mapping,
 				      GFP_KERNEL)) {
 			page_cache_release(page);
 			cFYI(1, ("Add page cache failed"));
+			data += PAGE_CACHE_SIZE;
+			bytes_read -= PAGE_CACHE_SIZE;
 			continue;
 		}