diff options
author | Yan, Zheng <zheng.z.yan@intel.com> | 2013-06-02 10:40:23 (GMT) |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-07-03 22:32:45 (GMT) |
commit | ccca4e37b1a912da3db68aee826557ea66145273 (patch) | |
tree | 5233ee63e39de174cf845e1a65308a0d99aae224 /net/ceph/osd_client.c | |
parent | eb845ff13a44477f8a411baedbf11d678b9daf0a (diff) | |
download | linux-fsl-qoriq-ccca4e37b1a912da3db68aee826557ea66145273.tar.xz |
libceph: fix truncate size calculation
check the "not truncated yet" case
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.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 3480b05..540dd29 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -733,12 +733,14 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, object_size = le32_to_cpu(layout->fl_object_size); object_base = off - objoff; - if (truncate_size <= object_base) { - truncate_size = 0; - } else { - truncate_size -= object_base; - if (truncate_size > object_size) - truncate_size = object_size; + if (!(truncate_seq == 1 && truncate_size == -1ULL)) { + if (truncate_size <= object_base) { + truncate_size = 0; + } else { + truncate_size -= object_base; + if (truncate_size > object_size) + truncate_size = object_size; + } } osd_req_op_extent_init(req, 0, opcode, objoff, objlen, |