]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: restrict async_recovery_targets to up osds 22889/head
authorNeha Ojha <nojha@redhat.com>
Wed, 20 Jun 2018 17:20:58 +0000 (13:20 -0400)
committerNathan Cutler <ncutler@suse.com>
Thu, 5 Jul 2018 20:27:01 +0000 (22:27 +0200)
When an osd that is part of the acting set and not the up set, gets chosen
as an async_recovery_target, it gets removed from the acting set. Since this
osd is no longer in the up or acting set, it is classified as a stray in
the next peering cycle. This results in choose_acting() looping between two
proposed acting sets.

To avoid this, we will only choose up osds as async_recovery_targets.

Signed-off-by: Neha Ojha <nojha@redhat.com>
(cherry picked from commit 7f1b6adec31e71ef4b3ec9b3c5cba8b1a4b7746f)

src/osd/PG.cc

index 639570a0d5c3192b590fcb01372d1d3edc29321f..8762334edbf102828b83ad2c383503645a09eb24 100644 (file)
@@ -1513,6 +1513,12 @@ void PG::choose_async_recovery_ec(const map<pg_shard_t, pg_info_t> &all_info,
     // do not include strays
     if (stray_set.find(shard_i) != stray_set.end())
       continue;
+    // Do not include an osd that is not up, since choosing it as
+    // an async_recovery_target will move it out of the acting set.
+    // This results in it being identified as a stray during peering,
+    // because it is no longer in the up or acting set.
+    if (!is_up(shard_i))
+      continue;
     auto shard_info = all_info.find(shard_i)->second;
     // for ec pools we rollback all entries past the authoritative
     // last_update *before* activation. This is relatively inexpensive
@@ -1555,6 +1561,12 @@ void PG::choose_async_recovery_replicated(const map<pg_shard_t, pg_info_t> &all_
     // do not include strays
     if (stray_set.find(shard_i) != stray_set.end())
       continue;
+    // Do not include an osd that is not up, since choosing it as
+    // an async_recovery_target will move it out of the acting set.
+    // This results in it being identified as a stray during peering,
+    // because it is no longer in the up or acting set.
+    if (!is_up(shard_i))
+      continue;
     auto shard_info = all_info.find(shard_i)->second;
     // use the approximate magnitude of the difference in length of
     // logs as the cost of recovery