]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ReplicatedPG: ignore starvation potential when taking write lock during promote
authorSage Weil <sage@inktank.com>
Mon, 3 Feb 2014 19:44:18 +0000 (11:44 -0800)
committerSage Weil <sage@inktank.com>
Sun, 16 Feb 2014 06:09:39 +0000 (22:09 -0800)
Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/ReplicatedPG.cc
src/osd/osd_types.h

index ad1d2cfa73c7f798d9fae428cc23cda7de1e77bb..8e958c5bce9a2d4d516e17cdcd89a0239791dfaf 100644 (file)
@@ -5596,8 +5596,8 @@ void ReplicatedPG::finish_promote(int r, OpRequestRef op,
   tctx->new_snapset.head_exists = true;
   dout(20) << __func__ << " new_snapset " << tctx->new_snapset << dendl;
 
-  // take RWWRITE lock for duration of our local write
-  if (!obc->rwstate.get_write_lock()) {
+  // take RWWRITE lock for duration of our local write.  ignore starvation.
+  if (!obc->rwstate.take_write_lock()) {
     assert(0 == "problem!");
   }
   tctx->lock_to_release = OpContext::W_LOCK;
index 8360218790dfb2578ca89eeb62832ecaad5dd403..8c1b49106af03e5c655e5ce2460d0c4864f59b05 100644 (file)
@@ -2549,6 +2549,14 @@ public:
        return false;
       }
     }
+    /// same as get_write_lock, but ignore starvation
+    bool take_write_lock() {
+      if (state == RWWRITE) {
+       count++;
+       return true;
+      }
+      return get_write_lock();
+    }
     void dec(list<OpRequestRef> *requeue) {
       assert(count > 0);
       assert(requeue);