diff options
author | Yan, Zheng <zheng.z.yan@intel.com> | 2012-11-19 10:49:08 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-17 08:46:50 -0800 |
commit | 608601fb5b6ea8b4dfbceea54c4e67638eaaabf5 (patch) | |
tree | f660ec0653f43bc2c95531f02f390eb7c687c183 | |
parent | 8ba21a9fbaff1ac20dcfe7d8bf6a6c24d7c80546 (diff) | |
download | lwn-608601fb5b6ea8b4dfbceea54c4e67638eaaabf5.tar.gz lwn-608601fb5b6ea8b4dfbceea54c4e67638eaaabf5.zip |
ceph: Fix __ceph_do_pending_vmtruncate
(cherry picked from commit a85f50b6ef93fbbb2ae932ce9b2376509d172796)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | fs/ceph/inode.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index ba95eea201bf..2971eaa65cdc 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -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); } |