From: Sage Weil Date: Mon, 3 Feb 2014 19:44:18 +0000 (-0800) Subject: osd/ReplicatedPG: ignore starvation potential when taking write lock during promote X-Git-Tag: v0.78~166^2~13 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6581ce9cf82647d5198b8db26c08d5f3a43de2e9;p=ceph.git osd/ReplicatedPG: ignore starvation potential when taking write lock during promote Signed-off-by: Sage Weil --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index ad1d2cfa73c..8e958c5bce9 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -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; diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 8360218790d..8c1b49106af 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -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 *requeue) { assert(count > 0); assert(requeue);