From: Sage Weil Date: Wed, 3 Feb 2010 00:34:04 +0000 (-0800) Subject: ceph: release all pages after successful osd write response X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=79788c698b290426320e60374ed1324e4b5c69eb;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 Signed-off-by: Sage Weil --- 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, 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);