ceph: properly release page upon error

When ceph_update_writeable_page fails (including -EAGAIN), it
unlocks (w/ unlock_page) the page but does not 'release'
(w/ page_cache_release) properly.

Upon error, properly set *pagep to NULL, indicating an error.

Signed-off-by: Taesoo Kim <tsgatesv@gmail.com>
Signed-off-by: Yan, Zheng <zyan@redhat.com>
This commit is contained in:
Taesoo Kim 2015-03-20 17:36:56 -04:00 committed by Ilya Dryomov
parent 1fe480235a
commit c1d00b2d9c
1 changed files with 4 additions and 0 deletions

View File

@ -1146,6 +1146,10 @@ static int ceph_write_begin(struct file *file, struct address_space *mapping,
inode, page, (int)pos, (int)len);
r = ceph_update_writeable_page(file, pos, len, page);
if (r < 0)
page_cache_release(page);
else
*pagep = page;
} while (r == -EAGAIN);
return r;