]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: build_push_op() handle short reads so recipient doesn't crash
authorDavid Zafman <dzafman@redhat.com>
Thu, 18 Dec 2014 00:59:09 +0000 (16:59 -0800)
committerDavid Zafman <dzafman@redhat.com>
Tue, 3 Mar 2015 19:21:00 +0000 (11:21 -0800)
Fixes: #8121
Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit b9a04846d18e1c6621d7f2794ec1fae02875bed2)

src/osd/ReplicatedPG.cc

index f1911c13f947b5ebe2cbeffb19aaa755f3b0fc8a..fbb1f10dab700b6e9030bc044ad51abd27cf5f7b 100644 (file)
@@ -8616,8 +8616,19 @@ int ReplicatedBackend::build_push_op(const ObjectRecoveryInfo &recovery_info,
       dout(10) << " extent " << p.get_start() << "~" << p.get_len()
               << " is actually " << p.get_start() << "~" << bit.length()
               << dendl;
-      p.set_len(bit.length());
+      interval_set<uint64_t>::iterator save = p++;
+      if (bit.length() == 0)
+        out_op->data_included.erase(save);     //Remove this empty interval
+      else
+        save.set_len(bit.length());
+      // Remove any other intervals present
+      while (p != out_op->data_included.end()) {
+        interval_set<uint64_t>::iterator save = p++;
+        out_op->data_included.erase(save);
+      }
       new_progress.data_complete = true;
+      out_op->data.claim_append(bit);
+      break;
     }
     out_op->data.claim_append(bit);
   }