]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: return rval which is negative
authorKefu Chai <kchai@redhat.com>
Thu, 20 Aug 2020 17:29:51 +0000 (01:29 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 24 Aug 2020 09:51:31 +0000 (17:51 +0800)
a less-than-zero rval indicates an error, and should not be normalized
to 0 if allows_returnvec() evaluates to false. probably we need a better
way to return a negative error code which does not fall into any known
error. but at this moment, grab the last rval and return it if it is
less than zero, can be used as a short term solution.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/pg.cc

index 99b79394b59e907eded54e0db663bb58b9fb4fe3..7821c7b0855dfaca775fec7371e5f040567deb9e 100644 (file)
@@ -629,7 +629,12 @@ seastar::future<Ref<MOSDOpReply>> PG::do_osd_ops(
                 obc,
                 ox_deleter = std::move(ox),
                 rvec = op_info.allows_returnvec()] {
-    auto result = m->ops.empty() || !rvec ? 0 : m->ops.back().rval.code;
+    // TODO: should stop at the first op which returns a negative retval,
+    //       cmpext uses it for returning the index of first unmatched byte
+    int result = m->ops.empty() ? 0 : m->ops.back().rval.code;
+    if (result > 0 && !rvec) {
+      result = 0;
+    }
     auto reply = make_message<MOSDOpReply>(m.get(),
                                            result,
                                            get_osdmap_epoch(),