]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_file: avoid long-ish delay on shutdown 37551/head
authorMatt Benjamin <mbenjamin@redhat.com>
Wed, 30 Sep 2020 19:13:04 +0000 (15:13 -0400)
committerVicente Cheng <freeze.bilsted@gmail.com>
Mon, 5 Oct 2020 15:41:11 +0000 (15:41 +0000)
Normal shutdown was likely to be delayed a substantial fraction
of rgw_nfs_namespace_expire_secs due to an ill-advised use of
this_thread::sleep_for.

Fixes: https://tracker.ceph.com/issues/47710
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
(cherry picked from commit 805f74956489e3158437acc1c3c12f267221843e)

src/rgw/librgw.cc
src/rgw/rgw_lib_frontend.h

index 9b0bc92423e87d6d8ec1e2cda1cea968e962df37..e8fa55c70b604b8df2d42818b8edbda9b6640c51 100644 (file)
@@ -130,8 +130,8 @@ namespace rgw {
        if (cur_gen != gen)
          goto restart; /* invalidated */
       }
+      cv.wait_for(uniq, std::chrono::seconds(delay_s));
       uniq.unlock();
-      std::this_thread::sleep_for(std::chrono::seconds(delay_s));
     }
   }
 
index 91ccc15df95632c0ea10859bb7a30fa80d1c6d6e..0f2276f4896693706fbe368698e1c9b2e8fc24da 100644 (file)
@@ -14,6 +14,7 @@ namespace rgw {
   class RGWLibProcess : public RGWProcess {
     RGWAccessKey access_key;
     std::mutex mtx;
+    std::condition_variable cv;
     int gen;
     bool shutdown;
 
@@ -36,6 +37,7 @@ namespace rgw {
       for (const auto& fs: mounted_fs) {
        fs.second->stop();
       }
+      cv.notify_all();
     }
 
     void register_fs(RGWLibFS* fs) {