From affa3a6cce547f2e7c7bc92d386814e6a01b2d69 Mon Sep 17 00:00:00 2001 From: Xuehan Xu Date: Wed, 10 Feb 2021 10:37:29 +0800 Subject: [PATCH] crimson/osd: capture pgref by value if it is to be referenced asynchronously Signed-off-by: Xuehan Xu --- src/crimson/osd/osd_operations/client_request.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/crimson/osd/osd_operations/client_request.cc b/src/crimson/osd/osd_operations/client_request.cc index cab167374d7..ee215c0033f 100644 --- a/src/crimson/osd/osd_operations/client_request.cc +++ b/src/crimson/osd/osd_operations/client_request.cc @@ -118,15 +118,16 @@ seastar::future<> ClientRequest::process_pg_op( seastar::future<> ClientRequest::process_op(Ref &pg) { - return with_blocking_future(handle.enter(pp(*pg).recover_missing)).then([&] { + return with_blocking_future(handle.enter(pp(*pg).recover_missing)).then( + [this, pg]() mutable { return do_recover_missing(pg); - }).then([&] { + }).then([this, pg]() mutable { return with_blocking_future(handle.enter(pp(*pg).get_obc)); - }).then([this, &pg]() -> PG::load_obc_ertr::future<> { + }).then([this, pg]() mutable -> PG::load_obc_ertr::future<> { op_info.set_from_op(&*m, *pg->get_osdmap()); - return pg->with_locked_obc(m, op_info, this, [this, &pg](auto obc) { + return pg->with_locked_obc(m, op_info, this, [this, pg](auto obc) mutable { return with_blocking_future(handle.enter(pp(*pg).process)).then( - [this, &pg, obc] { + [this, pg, obc]() mutable { return do_process(pg, obc); }); }); @@ -177,7 +178,7 @@ ClientRequest::do_process(Ref& pg, crimson::osd::ObjectContextRef obc) } return pg->do_osd_ops(m, obc, op_info).safe_then([this](Ref reply) { return conn->send(std::move(reply)); - }, crimson::ct_error::eagain::handle([this, &pg] { + }, crimson::ct_error::eagain::handle([this, pg]() mutable { return process_op(pg); })); } -- 2.39.5