]> Pileus Git - ~andy/linux/commitdiff
ceph: Clean up if error occurred in finish_read()
authorLi Wang <liwang@ubuntukylin.com>
Wed, 27 Nov 2013 14:28:13 +0000 (22:28 +0800)
committerSage Weil <sage@inktank.com>
Fri, 13 Dec 2013 17:13:28 +0000 (09:13 -0800)
Clean up if error occurred rather than going through normal process

Signed-off-by: Li Wang <liwang@ubuntukylin.com>
Signed-off-by: Yunchuan Wen <yunchuanwen@ubuntukylin.com>
Signed-off-by: Sage Weil <sage@inktank.com>
fs/ceph/addr.c

index ec3ba43b9faae73fba6d6352da9515a812ec9f36..c346b8479f99901e5f2e3eb6e9c95a3c1882febf 100644 (file)
@@ -256,6 +256,8 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg)
        for (i = 0; i < num_pages; i++) {
                struct page *page = osd_data->pages[i];
 
+               if (rc < 0)
+                       goto unlock;
                if (bytes < (int)PAGE_CACHE_SIZE) {
                        /* zero (remainder of) page */
                        int s = bytes < 0 ? 0 : bytes;
@@ -266,6 +268,7 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg)
                flush_dcache_page(page);
                SetPageUptodate(page);
                ceph_readpage_to_fscache(inode, page);
+unlock:
                unlock_page(page);
                page_cache_release(page);
                bytes -= PAGE_CACHE_SIZE;