Skip to content

Commit

Permalink
ceph: release all pages after successful osd write response
Browse files Browse the repository at this point in the history
We release all the pages, even if the osd response was
different than the number of pages written. This could only
happen due to truncation that arrives the osd in
different order, for which we want the pages released anyway.

Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Signed-off-by: Sage Weil <sage@newdream.net>
  • Loading branch information
Sage Weil committed Feb 3, 2010
1 parent 0c94899 commit 79788c6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions fs/ceph/addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,13 @@ static void writepages_finish(struct ceph_osd_request *req,
bytes = le64_to_cpu(op->extent.length);

if (rc >= 0) {
wrote = (bytes + (offset & ~PAGE_CACHE_MASK) + ~PAGE_CACHE_MASK)
>> PAGE_CACHE_SHIFT;
WARN_ON(wrote != req->r_num_pages);
/*
* Assume we wrote the pages we originally sent. The
* osd might reply with fewer pages if our writeback
* raced with a truncation and was adjusted at the osd,
* so don't believe the reply.
*/
wrote = req->r_num_pages;
} else {
wrote = 0;
mapping_set_error(mapping, rc);
Expand Down

0 comments on commit 79788c6

Please sign in to comment.