diff options
author | Kefu Chai <kchai@redhat.com> | 2020-08-20 19:29:51 +0200 |
---|---|---|
committer | Kefu Chai <kchai@redhat.com> | 2020-08-24 11:51:31 +0200 |
commit | c850a1d25d357daf36eeeb3af8c9abbada336739 (patch) | |
tree | cd14ffdd6c4300c769f64c6078c89bd1ed7a3fd3 | |
parent | crimson/osd: implement cmp-ext op (diff) | |
download | ceph-c850a1d25d357daf36eeeb3af8c9abbada336739.tar.xz ceph-c850a1d25d357daf36eeeb3af8c9abbada336739.zip |
crimson/osd: return rval which is negative
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>
-rw-r--r-- | src/crimson/osd/pg.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 99b79394b59..7821c7b0855 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -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(), |