From ecc211e76da5ecb507191f9919519f8c014ab477 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Fri, 19 Feb 2010 00:07:01 +0000 Subject: [PATCH] --- yaml --- r: 188723 b: refs/heads/master c: e63dc5c780ba32d6d8b3662eecce2b8d96489b41 h: refs/heads/master i: 188721: 135fd1525366f5397bfbc9eee5d4ab5b90299e04 188719: 2b0c335521bf5aa6351f16f5ce67d253953069d6 v: v3 --- [refs] | 2 +- trunk/fs/ceph/addr.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index ee90cd4ab7ba..ef2757f86feb 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5ecad6fd7bfd30b3eaea51345f546b81de7a6473 +refs/heads/master: e63dc5c780ba32d6d8b3662eecce2b8d96489b41 diff --git a/trunk/fs/ceph/addr.c b/trunk/fs/ceph/addr.c index 71f5ad1c1e26..25360d517d1b 100644 --- a/trunk/fs/ceph/addr.c +++ b/trunk/fs/ceph/addr.c @@ -514,6 +514,7 @@ static void writepages_finish(struct ceph_osd_request *req, u64 bytes = 0; struct ceph_client *client = ceph_inode_to_client(inode); long writeback_stat; + unsigned issued = __ceph_caps_issued(ci, NULL); /* parse reply */ replyhead = msg->front.iov_base; @@ -559,6 +560,16 @@ static void writepages_finish(struct ceph_osd_request *req, ceph_put_snap_context(snapc); dout("unlocking %d %p\n", i, page); end_page_writeback(page); + + /* + * We lost the cache cap, need to truncate the page before + * it is unlocked, otherwise we'd truncate it later in the + * page truncation thread, possibly losing some data that + * raced its way in + */ + if ((issued & CEPH_CAP_FILE_CACHE) == 0) + generic_error_remove_page(inode->i_mapping, page); + unlock_page(page); } dout("%p wrote+cleaned %d pages\n", inode, wrote);