From ead424591bf9237110c91a06467e9cb3764ba9f5 Mon Sep 17 00:00:00 2001 From: Tongliang Deng Date: Thu, 7 Jul 2022 10:42:53 +0000 Subject: [PATCH] rgwlc: fix removing LCEntry When `bucket_lc_process` returns `-ENOENT`, the lc entry is removed, but `set_entry(...)` is called after the removal which will give us the unwanted lc entry again. Fixes: c069eb7ff09b52003fa00a5cc83b1e52370032f5. Signed-off-by: Tongliang Deng --- src/rgw/rgw_lc.cc | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index c4604d3e4fe..1cfd4d05918 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -2122,7 +2122,7 @@ int RGWLC::process(int index, int max_lock_secs, LCWorker* worker, if (advance_head(lc_shard, *head.get(), *entry.get(), now) < 0) { goto exit; } - /* done with this shard */ + /* done with this shard */ if (head->get_marker().empty()) { ldpp_dout(this, 5) << "RGWLC::process() cycle finished lc_shard=" @@ -2227,17 +2227,20 @@ int RGWLC::process(int index, int max_lock_secs, LCWorker* worker, << dendl; /* not fatal, could result from a race */ } - } else if (ret < 0) { - entry->set_status(lc_failed); } else { - entry->set_status(lc_complete); - } - ret = sal_lc->set_entry(lc_shard, *entry); - if (ret < 0) { - ldpp_dout(this, 0) << "RGWLC::process() failed to set entry on " - << lc_shard << dendl; - /* fatal, locked */ - goto exit; + if (ret < 0) { + entry->set_status(lc_failed); + } else { + entry->set_status(lc_complete); + } + ret = sal_lc->set_entry(lc_shard, *entry); + if (ret < 0) { + ldpp_dout(this, 0) << "RGWLC::process() failed to set entry on " + << lc_shard + << dendl; + /* fatal, locked */ + goto exit; + } } /* done with this shard */ @@ -2257,12 +2260,9 @@ int RGWLC::process(int index, int max_lock_secs, LCWorker* worker, } } while(1 && !once && !going_down()); -notlocked: - delete lock; - return 0; - exit: lock->unlock(); +notlocked: delete lock; return 0; } -- 2.47.3