diff options
author | Yan, Zheng <zheng.z.yan@intel.com> | 2013-06-02 06:40:23 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-01-09 15:24:25 -0500 |
commit | 1f69fb068f24ac8bdf7b404dd49d0da7fb1a0d24 (patch) | |
tree | 58b0fdf01e9ef92ff324ad9d95b142906bd1781d | |
parent | aede2cb5c95588e703e358239a4f3842e21f103e (diff) |
libceph: fix truncate size calculation
commit ccca4e37b1a912da3db68aee826557ea66145273 upstream.
check the "not truncated yet" case
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-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 10e947cbc478..3e46e538cbf5 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, | |||
733 | 733 | ||
734 | object_size = le32_to_cpu(layout->fl_object_size); | 734 | object_size = le32_to_cpu(layout->fl_object_size); |
735 | object_base = off - objoff; | 735 | object_base = off - objoff; |
736 | if (truncate_size <= object_base) { | 736 | if (!(truncate_seq == 1 && truncate_size == -1ULL)) { |
737 | truncate_size = 0; | 737 | if (truncate_size <= object_base) { |
738 | } else { | 738 | truncate_size = 0; |
739 | truncate_size -= object_base; | 739 | } else { |
740 | if (truncate_size > object_size) | 740 | truncate_size -= object_base; |
741 | truncate_size = object_size; | 741 | if (truncate_size > object_size) |
742 | truncate_size = object_size; | ||
743 | } | ||
742 | } | 744 | } |
743 | 745 | ||
744 | osd_req_op_extent_init(req, 0, opcode, objoff, objlen, | 746 | osd_req_op_extent_init(req, 0, opcode, objoff, objlen, |