]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix unwatch crash at radosgw startup 53759/head
authorlichaochao <lichaochao2_yewu@cmss.chinamobile.com>
Wed, 27 Sep 2023 10:06:34 +0000 (12:06 +0200)
committerCasey Bodley <cbodley@redhat.com>
Mon, 2 Oct 2023 20:01:55 +0000 (16:01 -0400)
During radosgw initialization, if there is an exception in init_watch that causes the watcher registration to fail,
When finalize_watch is executed, a crash occurs due to unregister an unregistered watch.

Fixes: https://tracker.ceph.com/issues/60094
Signed-off-by: lichaochao <lichaochao2_yewu@cmss.chinamobile.com>
(cherry picked from commit acd43489038495899c1fc4f1e719b19e8b842ca1)

src/rgw/services/svc_notify.cc

index c634934e4844042d5db52c889901750129743281..7227ed1079be45fe691f0483d507e8cfd23a23f1 100644 (file)
@@ -239,7 +239,8 @@ void RGWSI_Notify::finalize_watch()
 {
   for (int i = 0; i < num_watchers; i++) {
     RGWWatcher *watcher = watchers[i];
-    watcher->unregister_watch();
+    if (watchers_set.find(i) != watchers_set.end())
+      watcher->unregister_watch();
     delete watcher;
   }