]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDMap.cc: remove pg_upmap/pg_upmap_items too if osd is gone
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 20 Jun 2018 01:04:19 +0000 (09:04 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Wed, 20 Jun 2018 01:04:19 +0000 (09:04 +0800)
If an osd is gone or moved out from the specific crush rule,
we should cancel any pg_upmap/pg_upmap_items still bound to
that osd too.

The original code does not work for the above case because
get_parent_of_type() will fail if that osd does not belong
to the crush_rule passed in and hence hits the assert below:

```
src/osd/OSDMap.cc: 4078: FAILED assert(target > 0)
```

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/osd/OSDMap.cc

index ae68cdf766c1612fc28ef06e1bd724dfec394c47..798b7fa1e296effa3efd577b41ed22c17820934c 100644 (file)
@@ -1693,17 +1693,18 @@ void OSDMap::maybe_remove_pg_upmaps(CephContext *cct,
     for (auto osd : raw) {
       if (type > 0) {
         auto parent = tmpmap.crush->get_parent_of_type(osd, type, crush_rule);
-        if (parent >= 0) {
+        if (parent < 0) {
+          auto r = parents.insert(parent);
+          if (!r.second) {
+            // two up-set osds come from same parent
+            to_cancel.insert(pg);
+            break;
+          }
+        } else {
           lderr(cct) << __func__ << " unable to get parent of raw osd."
                      << osd << " of pg " << pg
                      << dendl;
-          break;
-        }
-        auto r = parents.insert(parent);
-        if (!r.second) {
-          // two up-set osds come from same parent
-          to_cancel.insert(pg);
-          break;
+          // continue to do checks below
         }
       }
       // the above check validates collision only