]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix crash when creating new zone on init
authorYehuda Sadeh <yehuda@inktank.com>
Thu, 22 Aug 2013 17:53:12 +0000 (10:53 -0700)
committerSage Weil <sage@inktank.com>
Fri, 23 Aug 2013 22:37:18 +0000 (15:37 -0700)
Moving the watch/notify init before the zone init,
as we might need to send a notification.

Reviewed-by: Sage Weil <sage@inktank.com>
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
(cherry picked from commit 3d55534268de7124d29bd365ea65da8d2f63e501)

src/rgw/rgw_rados.cc

index 0bbbf177b7a3ca13e4763fd6db610f51101aa71c..03cc1ebfdb334dd80cca8560112ab889afd138b4 100644 (file)
@@ -875,6 +875,14 @@ int RGWRados::init_complete()
 {
   int ret;
 
+  if (need_watch_notify()) {
+    ret = init_watch();
+    if (ret < 0) {
+      lderr(cct) << "ERROR: failed to initialize watch" << dendl;
+      return ret;
+    }
+  }
+
   ret = region.init(cct, this);
   if (ret < 0)
     return ret;
@@ -912,14 +920,6 @@ int RGWRados::init_complete()
     }
   }
 
-  if (need_watch_notify()) {
-    ret = init_watch();
-    if (ret < 0) {
-      lderr(cct) << "ERROR: failed to initialize watch" << dendl;
-      return ret;
-    }
-  }
-
   map<string, RGWZone>::iterator ziter;
   for (ziter = region.zones.begin(); ziter != region.zones.end(); ++ziter) {
     const string& name = ziter->first;