]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
libceph: fix truncate size calculation
authorYan, Zheng <zheng.z.yan@intel.com>
Sun, 2 Jun 2013 10:40:23 +0000 (18:40 +0800)
committerSage Weil <sage@inktank.com>
Thu, 13 Jun 2013 15:46:30 +0000 (08:46 -0700)
check the "not truncated yet" case

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Reviewed-by: Sage Weil <sage@inktank.com>
net/ceph/osd_client.c

index 3480b058794b6c2f4dc62fd96e005ce725ce6c81..540dd29c9210b0704c52261f19de42b8b63a0c30 100644 (file)
@@ -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,