[CIFS] Fix cifs update of page cache. Write at correct offset when out of memory
authorSteve French <sfrench@hera.kernel.org>
Thu, 9 Jun 2005 21:44:07 +0000 (14:44 -0700)
committerSteve French <sfrench@hera.kernel.org>
Thu, 9 Jun 2005 21:44:07 +0000 (14:44 -0700)
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)
fs/cifs/CHANGES
fs/cifs/file.c

index 95483baab706baa9921eb14757c08da90970fdb5..dab4774ee7bbb6c7d9a92655a4a600d80c0da896 100644 (file)
@@ -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
 ------------
index dde2d251fc3d6b0d387559bf5c590ede89bcf80a..30ab70ce554716df92739f0b1643ce79053497e7 100644 (file)
@@ -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;
                }