diff options
author | Samuel Just <sam.just@inktank.com> | 2013-10-02 18:00:04 -0700 |
---|---|---|
committer | Samuel Just <sam.just@inktank.com> | 2013-10-04 13:50:09 -0700 |
commit | b87bc2311aa4da065477f402a869e2edc1558e2f (patch) | |
tree | 428411b515374ade9ad8e8c63dfdf7264350f157 | |
parent | 0c2769d3321bff6e85ec57c85a08ee0b8e751bcb (diff) | |
download | ceph-b87bc2311aa4da065477f402a869e2edc1558e2f.tar.gz |
ReplicatedPG: lock snapdir obc during write
Otherwise, we won't block properly in prep_push_backfill_object.
Signed-off-by: Samuel Just <sam.just@inktank.com>
-rw-r--r-- | src/osd/ReplicatedPG.cc | 13 | ||||
-rw-r--r-- | src/osd/ReplicatedPG.h | 9 |
2 files changed, 18 insertions, 4 deletions
diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 2627d74738c..eb32c6065ef 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4651,10 +4651,19 @@ void ReplicatedPG::apply_repop(RepGather *repop) if (repop->ctx->clone_obc) repop->ctx->clone_obc->ondisk_write_lock(); + bool unlock_snapset_obc = false; + if (repop->ctx->snapset_obc && repop->ctx->snapset_obc->obs.oi.soid != + repop->obc->obs.oi.soid) { + repop->ctx->snapset_obc->ondisk_write_lock(); + unlock_snapset_obc = true; + } + Context *oncommit = new C_OSD_OpCommit(this, repop); Context *onapplied = new C_OSD_OpApplied(this, repop); - Context *onapplied_sync = new C_OSD_OndiskWriteUnlock(repop->obc, - repop->ctx->clone_obc); + Context *onapplied_sync = new C_OSD_OndiskWriteUnlock( + repop->obc, + repop->ctx->clone_obc, + unlock_snapset_obc ? repop->ctx->snapset_obc : ObjectContextRef()); int r = osd->store->queue_transactions(osr.get(), repop->tls, onapplied, oncommit, onapplied_sync, repop->ctx->op); if (r) { derr << "apply_repop queue_transactions returned " << r << " on " << *repop << dendl; diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 026c4df2a90..b398dd2fea4 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -670,12 +670,17 @@ protected: } }; struct C_OSD_OndiskWriteUnlock : public Context { - ObjectContextRef obc, obc2; - C_OSD_OndiskWriteUnlock(ObjectContextRef o, ObjectContextRef o2 = ObjectContextRef()) : obc(o), obc2(o2) {} + ObjectContextRef obc, obc2, obc3; + C_OSD_OndiskWriteUnlock( + ObjectContextRef o, + ObjectContextRef o2 = ObjectContextRef(), + ObjectContextRef o3 = ObjectContextRef()) : obc(o), obc2(o2), obc3(o3) {} void finish(int r) { obc->ondisk_write_unlock(); if (obc2) obc2->ondisk_write_unlock(); + if (obc3) + obc3->ondisk_write_unlock(); } }; struct C_OSD_OndiskWriteUnlockList : public Context { |