aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-02-02 19:34:04 -0500
committerSage Weil <sage@newdream.net>2010-02-02 19:34:04 -0500
commit79788c698b290426320e60374ed1324e4b5c69eb (patch)
tree6c96d36c99c043c04c1d4c8686639f67f71232ba /fs
parent0c948992a00d478c17042f4790b7d6b35299cf94 (diff)
ceph: release all pages after successful osd write response
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/ceph/addr.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index a3bd9deb555c..8065dc92c611 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -524,9 +524,13 @@ static void writepages_finish(struct ceph_osd_request *req,
524 bytes = le64_to_cpu(op->extent.length); 524 bytes = le64_to_cpu(op->extent.length);
525 525
526 if (rc >= 0) { 526 if (rc >= 0) {
527 wrote = (bytes + (offset & ~PAGE_CACHE_MASK) + ~PAGE_CACHE_MASK) 527 /*
528 >> PAGE_CACHE_SHIFT; 528 * Assume we wrote the pages we originally sent. The
529 WARN_ON(wrote != req->r_num_pages); 529 * osd might reply with fewer pages if our writeback
530 * raced with a truncation and was adjusted at the osd,
531 * so don't believe the reply.
532 */
533 wrote = req->r_num_pages;
530 } else { 534 } else {
531 wrote = 0; 535 wrote = 0;
532 mapping_set_error(mapping, rc); 536 mapping_set_error(mapping, rc);