Skip to content

Commit 732a937

Browse files
committed
rgw: RGWSI_Notify drains the finisher before deleting RGWWatchers
the `C_ReinitWatch` context stores a pointer to `RGWWatcher *watcher` `RGWSI_Notify` schedules `C_ReinitWatch` callbacks to run on this finisher thread, which can race with the destruction of those `RGWWatchers` in `RGWSI_Notify::finalize_watch()` to avoid this race, delay the `RGWWatcher` deletions until after we've drained/stopped the Finisher thread in `RGWSI_Notify::shutdown()` Fixes: https://tracker.ceph.com/issues/73361 Signed-off-by: Casey Bodley <[email protected]>
1 parent 4aa6ed8 commit 732a937

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/rgw/services/svc_notify.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,6 @@ void RGWSI_Notify::finalize_watch(boost::asio::yield_context yield)
237237
});
238238
}
239239
throttle.wait();
240-
241-
watchers.clear();
242240
}
243241

244242
int RGWSI_Notify::do_start(optional_yield y, const DoutPrefixProvider *dpp)
@@ -303,9 +301,13 @@ void RGWSI_Notify::shutdown()
303301
});
304302
context.run();
305303

304+
// wait for any racing C_ReinitWatch calls on the finisher thread
305+
// before destroying the RGWWatchers
306306
finisher.wait_for_empty();
307307
finisher.stop();
308308

309+
watchers.clear();
310+
309311
finalized = true;
310312
}
311313

0 commit comments

Comments
 (0)