From a1f6b14e7fcd680f74a33e92845e54cbde69a5a3 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Tue, 24 Sep 2013 22:47:36 -0700 Subject: [PATCH] ReplicatedPG: take obc read lock prior to recovering an object to replicas Signed-off-by: Samuel Just --- src/osd/ReplicatedPG.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index fe22b22e2cb..191e7deb77a 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; } -- 2.47.3