]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: zero tail of page in readpage, readpages after short read
authorSage Weil <sage@newdream.net>
Thu, 13 Aug 2009 20:41:24 +0000 (13:41 -0700)
committerSage Weil <sage@newdream.net>
Thu, 13 Aug 2009 20:41:24 +0000 (13:41 -0700)
ceph_osdc_readpages isn't zeroing for us anymore (as of commit
23b81b9082c987a6f8221eb81c77fd7701086c5b).

src/kernel/addr.c

index 229a5d2b5dcaaa0fe14b91c2a0d6819b11f594cd..c9388bf9f3fde42b502b81ab2303f8a8135ba647 100644 (file)
@@ -211,6 +211,13 @@ static int readpage_nounlock(struct file *filp, struct page *page)
        if (unlikely(err < 0)) {
                SetPageError(page);
                goto out;
+       } else if (err < PAGE_CACHE_SIZE) {
+               /* zero fill remainder of page */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
+               zero_user_segment(page, err, PAGE_CACHE_SIZE);
+#else
+               zero_user_page(page, err, PAGE_CACHE_SIZE - err, KM_USER0);
+#endif
        }
        SetPageUptodate(page);
 
@@ -298,6 +305,15 @@ static int ceph_readpages(struct file *file, struct address_space *mapping,
                page = list_entry(page_list->prev, struct page, lru);
                list_del(&page->lru);
 
+               if (rc < PAGE_CACHE_SIZE) {
+                       /* zero remainder of page */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
+                       zero_user_segment(page, rc, PAGE_CACHE_SIZE);
+#else
+                       zero_user_page(page, rc, PAGE_CACHE_SIZE-rc, KM_USER0);
+#endif
+               }
+
                if (add_to_page_cache(page, mapping, page->index, GFP_NOFS)) {
                        page_cache_release(page);
                        dout("readpages %p add_to_page_cache failed %p\n",