]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ECUtil: fix slice bounds in slice_map()
authorSun Yuechi <sunyuechi@iscas.ac.cn>
Thu, 25 Jun 2026 13:39:11 +0000 (21:39 +0800)
committerSun Yuechi <sunyuechi@iscas.ac.cn>
Tue, 14 Jul 2026 09:08:02 +0000 (02:08 -0700)
slice_map() accumulated the slice bounds against the wrong operands,
and included parity shards in ro_start and ro_end, which only track
data.

Introduced by 9e2841ab167 ("osd: Introduce optimized EC").

Signed-off-by: Sun Yuechi <sunyuechi@iscas.ac.cn>
src/osd/ECUtil.cc

index 68ae458331a8de9b00d8f1e0889b1ccafce46a87..74b58b1444a69670a7bd95f654cf54eaa58836c9 100644 (file)
@@ -810,14 +810,15 @@ shard_extent_map_t shard_extent_map_t::slice_map(
     extent_map iemap = emap.intersect(offset, length);
 
     if (!iemap.empty()) {
+      raw_shard_id_t raw_shard = sinfo->get_raw_shard(shard);
       slice.start_offset = min(slice.start_offset, iemap.get_start_off());
-      slice.end_offset = max(slice.start_offset, iemap.get_end_off());
-      slice.ro_start = min(slice.start_offset,
-                           calc_ro_offset(sinfo->get_raw_shard(shard),
-                                          iemap.get_start_off()));
-      slice.ro_end = min(slice.ro_end,
-                         calc_ro_end(sinfo->get_raw_shard(shard),
-                                     iemap.get_end_off()));
+      slice.end_offset = max(slice.end_offset, iemap.get_end_off());
+      if (raw_shard < sinfo->get_k()) {
+        slice.ro_start = min(slice.ro_start,
+                             calc_ro_offset(raw_shard, iemap.get_start_off()));
+        slice.ro_end = max(slice.ro_end,
+                           calc_ro_end(raw_shard, iemap.get_end_off()));
+      }
       slice.extent_maps.emplace(shard, iemap);
     }
   }