]> Pileus Git - ~andy/linux/commitdiff
ceph: Fix __ceph_do_pending_vmtruncate
authorYan, Zheng <zheng.z.yan@intel.com>
Mon, 19 Nov 2012 02:49:08 +0000 (10:49 +0800)
committerAlex Elder <elder@inktank.com>
Thu, 13 Dec 2012 14:13:08 +0000 (08:13 -0600)
we should set i_truncate_pending to 0 after page cache is truncated
to i_truncate_size

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Signed-off-by: Sage Weil <sage@inktank.com>
fs/ceph/inode.c

index 4b5762ef7c2bf87ecb937a70a55ae20b100d77c9..81613bced19f4f53f4684ef5056f87fa47673777 100644 (file)
@@ -1466,7 +1466,7 @@ void __ceph_do_pending_vmtruncate(struct inode *inode)
 {
        struct ceph_inode_info *ci = ceph_inode(inode);
        u64 to;
-       int wrbuffer_refs, wake = 0;
+       int wrbuffer_refs, finish = 0;
 
 retry:
        spin_lock(&ci->i_ceph_lock);
@@ -1498,15 +1498,18 @@ retry:
        truncate_inode_pages(inode->i_mapping, to);
 
        spin_lock(&ci->i_ceph_lock);
-       ci->i_truncate_pending--;
-       if (ci->i_truncate_pending == 0)
-               wake = 1;
+       if (to == ci->i_truncate_size) {
+               ci->i_truncate_pending = 0;
+               finish = 1;
+       }
        spin_unlock(&ci->i_ceph_lock);
+       if (!finish)
+               goto retry;
 
        if (wrbuffer_refs == 0)
                ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL);
-       if (wake)
-               wake_up_all(&ci->i_cap_wq);
+
+       wake_up_all(&ci->i_cap_wq);
 }