From 25ef2655137f78b9583292bb12f67304ae1e3901 Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Thu, 11 Aug 2022 18:19:59 -0400 Subject: [PATCH] rgw: Reread sync status after acquiring lock in `RGWDataSyncCR` If someone else got there first, we won't smash their work. Signed-off-by: Adam C. Emerson --- src/rgw/driver/rados/rgw_data_sync.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rgw/driver/rados/rgw_data_sync.cc b/src/rgw/driver/rados/rgw_data_sync.cc index d11838495bf..2f8f079e9ad 100644 --- a/src/rgw/driver/rados/rgw_data_sync.cc +++ b/src/rgw/driver/rados/rgw_data_sync.cc @@ -2290,6 +2290,13 @@ public: yield set_sleeping(true); } tn->log(5, "acquired data sync status lease"); + + // Reread sync status now that we've acquired the lock! + yield call(new RGWReadDataSyncStatusCoroutine(sc, &sync_status, objvs)); + if (retcode < 0) { + tn->log(0, SSTR("ERROR: failed to fetch sync status, retcode=" << retcode)); + return set_cr_error(retcode); + } } /* state: init status */ -- 2.39.5