提交 c1d00b2d 编写于 作者: T Taesoo Kim 提交者: Ilya Dryomov

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: NTaesoo Kim <tsgatesv@gmail.com>
Signed-off-by: NYan, Zheng <zyan@redhat.com>
上级 1fe48023
...@@ -1146,6 +1146,10 @@ static int ceph_write_begin(struct file *file, struct address_space *mapping, ...@@ -1146,6 +1146,10 @@ static int ceph_write_begin(struct file *file, struct address_space *mapping,
inode, page, (int)pos, (int)len); inode, page, (int)pos, (int)len);
r = ceph_update_writeable_page(file, pos, len, page); r = ceph_update_writeable_page(file, pos, len, page);
if (r < 0)
page_cache_release(page);
else
*pagep = page;
} while (r == -EAGAIN); } while (r == -EAGAIN);
return r; return r;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册