]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: set individual osd op rvals
authorJosh Durgin <josh.durgin@inktank.com>
Fri, 7 Feb 2014 02:20:06 +0000 (18:20 -0800)
committerJosh Durgin <josh.durgin@inktank.com>
Tue, 18 Feb 2014 20:34:33 +0000 (12:34 -0800)
This takes care of things that can fail before transaction is
executed, like omap comparison. Getting individual rvals from a
transaction requires more refactoring, so I'm leaving it for a later
cleanup.

Fixes: #6483
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
src/osd/ReplicatedPG.cc
src/test/librados/c_read_operations.cc

index 3202c658a924f09ddc43bfdb2f249c7052c98652..9a04358ec5c61a599fce73bc2d42c9124cc70912 100644 (file)
@@ -4385,6 +4385,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
     ctx->bytes_read += osd_op.outdata.length();
 
   fail:
+    osd_op.rval = result;
     if (result < 0 && (op.flags & CEPH_OSD_OP_FLAG_FAILOK))
       result = 0;
 
index 90fb8afc078bf2744aae209ecd7fe47acbc63625..106f6b4f162d99e36f5641da4393d2e1025117a3 100644 (file)
@@ -135,7 +135,7 @@ TEST_F(CReadOpsTest, SetOpFlags) {
                     &bytes_read, &rval);
   rados_read_op_set_flags(op, LIBRADOS_OP_FLAG_FAILOK);
   EXPECT_EQ(0, rados_read_op_operate(op, ioctx, obj, 0));
-  EXPECT_EQ(0, rval);
+  EXPECT_EQ(-EIO, rval);
   EXPECT_EQ(0u, bytes_read);
   EXPECT_EQ((char*)NULL, out);
   rados_release_read_op(op);
@@ -477,8 +477,7 @@ TEST_F(CReadOpsTest, Omap) {
   rados_write_op_omap_rm_keys(op, keys, 2);
   EXPECT_EQ(-ECANCELED, rados_write_op_operate(op, ioctx, obj, NULL, 0));
   rados_release_write_op(op);
-  // due to http://tracker.ceph.com/issues/6483 this is 0:
-  EXPECT_EQ(0, r_vals);
+  ASSERT_EQ(-ECANCELED, r_vals);
 
   // verifying the keys are still there, and then remove them
   op = rados_create_write_op();