diff options
-rw-r--r-- | fs/nfs/objlayout/objio_osd.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c index 86d7595aca8f..f50d3e8d6f22 100644 --- a/fs/nfs/objlayout/objio_osd.c +++ b/fs/nfs/objlayout/objio_osd.c | |||
@@ -489,8 +489,16 @@ static struct page *__r4w_get_page(void *priv, u64 offset, bool *uptodate) | |||
489 | struct nfs_write_data *wdata = objios->oir.rpcdata; | 489 | struct nfs_write_data *wdata = objios->oir.rpcdata; |
490 | struct address_space *mapping = wdata->header->inode->i_mapping; | 490 | struct address_space *mapping = wdata->header->inode->i_mapping; |
491 | pgoff_t index = offset / PAGE_SIZE; | 491 | pgoff_t index = offset / PAGE_SIZE; |
492 | struct page *page = find_get_page(mapping, index); | 492 | struct page *page; |
493 | loff_t i_size = i_size_read(wdata->header->inode); | ||
493 | 494 | ||
495 | if (offset >= i_size) { | ||
496 | *uptodate = true; | ||
497 | dprintk("%s: g_zero_page index=0x%lx\n", __func__, index); | ||
498 | return ZERO_PAGE(0); | ||
499 | } | ||
500 | |||
501 | page = find_get_page(mapping, index); | ||
494 | if (!page) { | 502 | if (!page) { |
495 | page = find_or_create_page(mapping, index, GFP_NOFS); | 503 | page = find_or_create_page(mapping, index, GFP_NOFS); |
496 | if (unlikely(!page)) { | 504 | if (unlikely(!page)) { |
@@ -510,8 +518,10 @@ static struct page *__r4w_get_page(void *priv, u64 offset, bool *uptodate) | |||
510 | 518 | ||
511 | static void __r4w_put_page(void *priv, struct page *page) | 519 | static void __r4w_put_page(void *priv, struct page *page) |
512 | { | 520 | { |
513 | dprintk("%s: index=0x%lx\n", __func__, page->index); | 521 | dprintk("%s: index=0x%lx\n", __func__, |
514 | page_cache_release(page); | 522 | (page == ZERO_PAGE(0)) ? -1UL : page->index); |
523 | if (ZERO_PAGE(0) != page) | ||
524 | page_cache_release(page); | ||
515 | return; | 525 | return; |
516 | } | 526 | } |
517 | 527 | ||