aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/addr.c
diff options
context:
space:
mode:
authorDavid Zafman <david.zafman@inktank.com>2012-12-03 22:14:05 -0500
committerAlex Elder <elder@inktank.com>2012-12-13 09:13:09 -0500
commit8884d53dd63b1d9315b343564fcbe1ede004a99e (patch)
tree9826a8ce6cac8b7c1b0fe27ca50a81572d69c59c /fs/ceph/addr.c
parent0e5e1774a92e6fe9c511585de8f078b4c4c68dbb (diff)
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/3370 Signed-off-by: David Zafman <david.zafman@inktank.com> Reviewed-by: Alex Elder <elder@inktank.com>
Diffstat (limited to 'fs/ceph/addr.c')
-rw-r--r--fs/ceph/addr.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 21a07187df05..8e8a818cba07 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -267,6 +267,14 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg)
267 kfree(req->r_pages); 267 kfree(req->r_pages);
268} 268}
269 269
270static void ceph_unlock_page_vector(struct page **pages, int num_pages)
271{
272 int i;
273
274 for (i = 0; i < num_pages; i++)
275 unlock_page(pages[i]);
276}
277
270/* 278/*
271 * start an async read(ahead) operation. return nr_pages we submitted 279 * start an async read(ahead) operation. return nr_pages we submitted
272 * a read for on success, or negative error code. 280 * 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 return nr_pages; 355 return nr_pages;
348 356
349out_pages: 357out_pages:
358 ceph_unlock_page_vector(pages, nr_pages);
350 ceph_release_page_vector(pages, nr_pages); 359 ceph_release_page_vector(pages, nr_pages);
351out: 360out:
352 ceph_osdc_put_request(req); 361 ceph_osdc_put_request(req);