From 9132123aea4444f7f3662a483c0b9e36bc5855a0 Mon Sep 17 00:00:00 2001 From: myoungwon oh Date: Wed, 2 Dec 2020 11:51:10 +0900 Subject: [PATCH] osd: do not reply EAGAIN if get_lock_type() is false This will be retried later Signed-off-by: Myoungwon Oh --- src/osd/PrimaryLogPG.cc | 14 +++++++------- src/osd/PrimaryLogPG.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 0831fa8fb0579..68df64cf5f93a 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -10179,14 +10179,14 @@ hobject_t PrimaryLogPG::get_fpoid_from_chunk(const hobject_t soid, bufferlist& c return target; } -void PrimaryLogPG::finish_set_dedup(hobject_t oid, int r, ceph_tid_t tid, uint64_t offset) +int PrimaryLogPG::finish_set_dedup(hobject_t oid, int r, ceph_tid_t tid, uint64_t offset) { dout(10) << __func__ << " " << oid << " tid " << tid << " " << cpp_strerror(r) << dendl; map::iterator p = manifest_ops.find(oid); if (p == manifest_ops.end()) { dout(10) << __func__ << " no manifest_op found" << dendl; - return; + return -EINVAL; } ManifestOpRef mop = p->second; mop->results[offset] = r; @@ -10196,13 +10196,13 @@ void PrimaryLogPG::finish_set_dedup(hobject_t oid, int r, ceph_tid_t tid, uint64 } if (mop->num_chunks != mop->results.size()) { // there are on-going works - return; + return -EINPROGRESS; } ObjectContextRef obc = get_object_context(oid, false); if (!obc) { if (mop->op) osd->reply_op_error(mop->op, -EINVAL); - return; + return -EINVAL; } ceph_assert(obc->is_blocked()); obc->stop_block(); @@ -10212,7 +10212,7 @@ void PrimaryLogPG::finish_set_dedup(hobject_t oid, int r, ceph_tid_t tid, uint64 ceph_assert(mop->num_chunks == mop->results.size()); manifest_ops.erase(oid); osd->reply_op_error(mop->op, mop->results[0]); - return; + return -EIO; } if (mop->chunks.size()) { @@ -10227,8 +10227,7 @@ void PrimaryLogPG::finish_set_dedup(hobject_t oid, int r, ceph_tid_t tid, uint64 } else if (mop->op) { dout(10) << __func__ << " waiting on write lock " << mop->op << dendl; close_op_ctx(ctx.release()); - osd->reply_op_error(mop->op, -EAGAIN); - return; + return -EAGAIN; } ctx->at_version = get_next_version(); @@ -10282,6 +10281,7 @@ void PrimaryLogPG::finish_set_dedup(hobject_t oid, int r, ceph_tid_t tid, uint64 osd->reply_op_error(mop->op, r); manifest_ops.erase(oid); + return 0; } int PrimaryLogPG::start_flush( diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 8ce17ba437e84..bc682332dba05 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -1516,7 +1516,7 @@ protected: std::map& chunks); int start_dedup(OpRequestRef op, ObjectContextRef obc); hobject_t get_fpoid_from_chunk(const hobject_t soid, bufferlist& chunk); - void finish_set_dedup(hobject_t oid, int r, ceph_tid_t tid, uint64_t offset); + int finish_set_dedup(hobject_t oid, int r, ceph_tid_t tid, uint64_t offset); friend struct C_ProxyChunkRead; friend class PromoteManifestCallback; -- 2.39.5