mirror of
https://github.com/ceph/ceph
synced 2025-02-23 19:17:37 +00:00
crimson/osd: return error code to break next op in cmp_ext
Signed-off-by: chunmei-liu <chunmei.liu@intel.com>
This commit is contained in:
parent
9e3d8521cf
commit
a0c9d06bda
@ -1147,6 +1147,7 @@ namespace ct_error {
|
||||
using enametoolong = ct_error_code<static_cast<int>(std::errc::filename_too_long)>;
|
||||
using eexist = ct_error_code<static_cast<int>(std::errc::file_exists)>;
|
||||
using edquot = ct_error_code<int(122)>;
|
||||
using cmp_fail = ct_error_code<int(4095)>;
|
||||
|
||||
struct pass_further_all {
|
||||
template <class ErrorT>
|
||||
|
@ -43,6 +43,7 @@ class OpsExecuter : public seastar::enable_lw_shared_from_this<OpsExecuter> {
|
||||
crimson::ct_error::eexist,
|
||||
crimson::ct_error::enospc,
|
||||
crimson::ct_error::edquot,
|
||||
crimson::ct_error::cmp_fail,
|
||||
crimson::ct_error::eagain,
|
||||
crimson::ct_error::invarg,
|
||||
crimson::ct_error::erange,
|
||||
|
@ -398,19 +398,19 @@ PGBackend::cmp_ext(const ObjectState& os, OSDOp& osd_op)
|
||||
} else {
|
||||
read_ext = _read(os.oi.soid, op.extent.offset, ext_len, 0);
|
||||
}
|
||||
return read_ext.safe_then_interruptible([&osd_op](auto&& read_bl) {
|
||||
int32_t retcode = 0;
|
||||
return read_ext.safe_then_interruptible([&osd_op](auto&& read_bl)
|
||||
-> cmp_ext_errorator::future<> {
|
||||
for (unsigned index = 0; index < osd_op.indata.length(); index++) {
|
||||
char byte_in_op = osd_op.indata[index];
|
||||
char byte_from_disk = (index < read_bl.length() ? read_bl[index] : 0);
|
||||
if (byte_in_op != byte_from_disk) {
|
||||
logger().debug("cmp_ext: mismatch at {}", index);
|
||||
retcode = -MAX_ERRNO - index;
|
||||
break;
|
||||
osd_op.rval = -MAX_ERRNO - index;
|
||||
return crimson::ct_error::cmp_fail::make();
|
||||
}
|
||||
}
|
||||
logger().debug("cmp_ext: {}", retcode);
|
||||
osd_op.rval = retcode;
|
||||
osd_op.rval = 0;
|
||||
return cmp_ext_errorator::make_ready_future<>();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,8 @@ public:
|
||||
const ObjectState& os,
|
||||
OSDOp& osd_op);
|
||||
using cmp_ext_errorator = ll_read_errorator::extend<
|
||||
crimson::ct_error::invarg>;
|
||||
crimson::ct_error::invarg,
|
||||
crimson::ct_error::cmp_fail>;
|
||||
using cmp_ext_ierrorator =
|
||||
::crimson::interruptible::interruptible_errorator<
|
||||
::crimson::osd::IOInterruptCondition,
|
||||
|
Loading…
Reference in New Issue
Block a user