From: Samuel Just Date: Wed, 25 Sep 2013 05:47:36 +0000 (-0700) Subject: ReplicatedPG: take obc read lock prior to recovering an object to replicas X-Git-Tag: v0.71~68^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a1f6b14e7fcd680f74a33e92845e54cbde69a5a3;p=ceph.git ReplicatedPG: take obc read lock prior to recovering an object to replicas Signed-off-by: Samuel Just --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index fe22b22e2cbb..191e7deb77a1 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -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; }