]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
RadosModel: error handling fixes
authorSamuel Just <rexludorum@gmail.com>
Tue, 12 Apr 2011 19:02:22 +0000 (12:02 -0700)
committerSamuel Just <samuel.just@dreamhost.com>
Wed, 13 Apr 2011 22:05:41 +0000 (15:05 -0700)
ReadOp should read the recieve length to prevent buffer error.

Check error codes on WriteOp and ReadOp.

Signed-off-by: Samuel Just <rexludorum@gmail.com>
src/test/osd/RadosModel.h

index ca0c25b9b120686f297b7bafba6b88e039f9cd46..feb4ac05ea9dec4b7237d6cdd85825f0d167bda1 100644 (file)
@@ -354,6 +354,10 @@ struct WriteOp : public TestOp
     context->state_lock.Lock();
     context->oid_in_use.erase(oid);
     context->oid_not_in_use.insert(oid);
+    if (int err = completion->get_return_value()) {
+      cerr << "Error: oid " << oid << " write returned error code "
+          << err << std::endl;
+    }
     context->kick();
     done = true;
     context->state_lock.Unlock();
@@ -403,13 +407,18 @@ struct ReadOp : public TestOp
     context->state_lock.Lock();
     context->oid_in_use.erase(oid);
     context->oid_not_in_use.insert(oid);
-    string to_check;
-    result.copy(0, old_value.length(), to_check);
-    if (to_check != old_value) {
-      context->errors++;
-      cerr << "Error: oid " << oid << " read returned \n"
-          << to_check << "\nShould have returned\n"
-          << old_value << "\nCurrent snap is " << context->current_snap << std::endl;
+    if (int err = completion->get_return_value()) {
+      cerr << "Error: oid " << oid << " read returned error code "
+          << err << std::endl;
+    } else {
+      string to_check;
+      result.copy(0, result.length(), to_check);
+      if (to_check != old_value) {
+       context->errors++;
+       cerr << "Error: oid " << oid << " read returned \n"
+            << to_check << "\nShould have returned\n"
+            << old_value << "\nCurrent snap is " << context->current_snap << std::endl;
+      }
     }
     context->kick();
     done = true;