summaryrefslogtreecommitdiffstats
path: root/net/ceph/osd_client.c
diff options
context:
space:
mode:
authorYan, Zheng <zheng.z.yan@intel.com>2012-11-30 06:49:51 +0100
committerAlex Elder <elder@inktank.com>2013-01-17 19:42:37 +0100
commita41bad1a9b9f9982eb9b451165724c5f81096683 (patch)
tree1bc98665b919bb81d68152422484a5af220af4d2 /net/ceph/osd_client.c
parentceph: Check for created flag in response from mds (diff)
downloadlinux-a41bad1a9b9f9982eb9b451165724c5f81096683.tar.xz
linux-a41bad1a9b9f9982eb9b451165724c5f81096683.zip
ceph: re-calculate truncate_size for strip object
Otherwise osd may truncate the object to larger size. Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com> Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'net/ceph/osd_client.c')
-rw-r--r--net/ceph/osd_client.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index eb9a44478764..267f183b801a 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -76,8 +76,16 @@ int ceph_calc_raw_layout(struct ceph_osd_client *osdc,
orig_len - *plen, off, *plen);
if (op_has_extent(op->op)) {
+ u32 osize = le32_to_cpu(layout->fl_object_size);
op->extent.offset = objoff;
op->extent.length = objlen;
+ if (op->extent.truncate_size <= off - objoff) {
+ op->extent.truncate_size = 0;
+ } else {
+ op->extent.truncate_size -= off - objoff;
+ if (op->extent.truncate_size > osize)
+ op->extent.truncate_size = osize;
+ }
}
req->r_num_pages = calc_pages_for(off, *plen);
req->r_page_alignment = off & ~PAGE_MASK;