提交 8884d53d 编写于 作者: D David Zafman 提交者: Alex Elder

libceph: Unlock unprocessed pages in start_read() error path

Function start_read() can get an error before processing all pages.
It must not only release the remaining pages, but unlock them too.

This fixes http://tracker.newdream.net/issues/3370Signed-off-by: NDavid Zafman <david.zafman@inktank.com>
Reviewed-by: NAlex Elder <elder@inktank.com>
上级 0e5e1774
...@@ -267,6 +267,14 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg) ...@@ -267,6 +267,14 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg)
kfree(req->r_pages); kfree(req->r_pages);
} }
static void ceph_unlock_page_vector(struct page **pages, int num_pages)
{
int i;
for (i = 0; i < num_pages; i++)
unlock_page(pages[i]);
}
/* /*
* start an async read(ahead) operation. return nr_pages we submitted * start an async read(ahead) operation. return nr_pages we submitted
* a read for on success, or negative error code. * a read for on success, or negative error code.
...@@ -347,6 +355,7 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max) ...@@ -347,6 +355,7 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max)
return nr_pages; return nr_pages;
out_pages: out_pages:
ceph_unlock_page_vector(pages, nr_pages);
ceph_release_page_vector(pages, nr_pages); ceph_release_page_vector(pages, nr_pages);
out: out:
ceph_osdc_put_request(req); ceph_osdc_put_request(req);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册