summaryrefslogtreecommitdiff
path: root/fs/ceph/inode.c
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@hq.newdream.net>2010-02-09 11:08:40 -0800
committerSage Weil <sage@newdream.net>2010-02-11 11:48:51 -0800
commit3d497d858ae6e5f23a28783030aecc69074e102d (patch)
tree43c69325be88a7a1ea3842d5f64a33d613fb710c /fs/ceph/inode.c
parent4af6b2257ee0eb8f4bf3b1dc8acb643c0e8a887f (diff)
ceph: fix truncation when not holding caps
A truncation should occur when either we have the specified caps for the file, or (in cases where we are not the only ones referencing the file) when it is mapped or when it is opened. The latter two cases were not handled. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/inode.c')
-rw-r--r--fs/ceph/inode.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index a4f573ab232..af85f2de2f7 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -416,9 +416,17 @@ int ceph_fill_file_size(struct inode *inode, int issued,
dout("truncate_seq %u -> %u\n",
ci->i_truncate_seq, truncate_seq);
ci->i_truncate_seq = truncate_seq;
- if (issued & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_RD|
+ /*
+ * If we hold relevant caps, or in the case where we're
+ * not the only client referencing this file and we
+ * don't hold those caps, then we need to check whether
+ * the file is either opened or mmaped
+ */
+ if ((issued & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_RD|
CEPH_CAP_FILE_WR|CEPH_CAP_FILE_BUFFER|
- CEPH_CAP_FILE_EXCL)) {
+ CEPH_CAP_FILE_EXCL)) ||
+ mapping_mapped(inode->i_mapping) ||
+ __ceph_caps_file_wanted(ci)) {
ci->i_truncate_pending++;
queue_trunc = 1;
}