From: David Zafman Date: Tue, 4 Dec 2012 03:14:05 +0000 (-0800) Subject: libceph: Unlock unprocessed pages in start_read() error path X-Git-Tag: v3.4.26~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=359c4ea7baf79484cc3561f0040f9d5e367155fe;p=platform%2Fkernel%2Flinux-stable.git 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 Reviewed-by: Alex Elder (cherry picked from commit 8884d53dd63b1d9315b343564fcbe1ede004a99e) Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index e009fde..bb01881 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) 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 * 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) return nr_pages; out_pages: + ceph_unlock_page_vector(pages, nr_pages); ceph_release_page_vector(pages, nr_pages); out: ceph_osdc_put_request(req);