]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: take obc read lock prior to recovering an object to replicas 631/head
authorSamuel Just <sam.just@inktank.com>
Wed, 25 Sep 2013 05:47:36 +0000 (22:47 -0700)
committerSamuel Just <sam.just@inktank.com>
Thu, 26 Sep 2013 18:24:29 +0000 (11:24 -0700)
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/ReplicatedPG.cc

index fe22b22e2cbb2d571d528fe5ab69f954cad58c5a..191e7deb77a1ab2352a4e79407b3ba73e5b77f05 100644 (file)
@@ -7821,11 +7821,19 @@ int ReplicatedPG::prep_object_replica_pushes(
   start_recovery_op(soid);
   assert(!recovering.count(soid));
   recovering.insert(soid);
+
+  /* We need this in case there is an in progress write on the object.  In fact,
+   * the only possible write is an update to the xattr due to a lost_revert --
+   * a client write would be blocked since the object is degraded.
+   * In almost all cases, therefore, this lock should be uncontended.
+   */
+  obc->ondisk_read_lock();
   pgbackend->recover_object(
     soid,
     ObjectContextRef(),
     obc, // has snapset context
     h);
+  obc->ondisk_read_unlock();
   return 1;
 }