Commit f36132a7 authored by Li Wang's avatar Li Wang Committed by Sage Weil

ceph: Clean up if error occurred in finish_read()

Clean up if error occurred rather than going through normal process
Signed-off-by: default avatarLi Wang <liwang@ubuntukylin.com>
Signed-off-by: default avatarYunchuan Wen <yunchuanwen@ubuntukylin.com>
Signed-off-by: default avatarSage Weil <sage@inktank.com>
parent 8eb4efb0
...@@ -256,6 +256,8 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg) ...@@ -256,6 +256,8 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg)
for (i = 0; i < num_pages; i++) { for (i = 0; i < num_pages; i++) {
struct page *page = osd_data->pages[i]; struct page *page = osd_data->pages[i];
if (rc < 0)
goto unlock;
if (bytes < (int)PAGE_CACHE_SIZE) { if (bytes < (int)PAGE_CACHE_SIZE) {
/* zero (remainder of) page */ /* zero (remainder of) page */
int s = bytes < 0 ? 0 : bytes; int s = bytes < 0 ? 0 : bytes;
...@@ -266,6 +268,7 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg) ...@@ -266,6 +268,7 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg)
flush_dcache_page(page); flush_dcache_page(page);
SetPageUptodate(page); SetPageUptodate(page);
ceph_readpage_to_fscache(inode, page); ceph_readpage_to_fscache(inode, page);
unlock:
unlock_page(page); unlock_page(page);
page_cache_release(page); page_cache_release(page);
bytes -= PAGE_CACHE_SIZE; bytes -= PAGE_CACHE_SIZE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment