]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson: fix assert_aligned(size) in trim_data_reservation 44490/head
authorchunmei-liu <chunmei.liu@intel.com>
Tue, 11 Jan 2022 03:44:43 +0000 (19:44 -0800)
committerchunmei-liu <chunmei.liu@intel.com>
Tue, 11 Jan 2022 23:16:16 +0000 (15:16 -0800)
Signed-off-by: chunmei-liu <chunmei.liu@intel.com>
signed-off-by: Samuel Just <sjust@redhat.com>

src/crimson/os/seastore/object_data_handler.cc

index 9bc90405c9cbede4a3a37b26a5b1066f9dde85c1..583e6118768fc7b7f7e7ac29cd57412f24ea13d2 100644 (file)
@@ -308,12 +308,17 @@ ObjectDataHandler::clear_ret ObjectDataHandler::trim_data_reservation(
          pin.get_laddr() <= object_data.get_reserved_data_base() + size);
        auto pin_offset = pin.get_laddr() -
          object_data.get_reserved_data_base();
-       if (pin.get_paddr().is_zero()) {
+       if ((pin.get_laddr() == (object_data.get_reserved_data_base() + size)) ||
+         (pin.get_paddr().is_zero())) {
+         /* First pin is exactly at the boundary or is a zero pin.  Either way,
+          * remove all pins and add a single zero pin to the end. */
          to_write.emplace_back(
            pin.get_laddr(),
            object_data.get_reserved_data_len() - pin_offset);
          return clear_iertr::now();
        } else {
+         /* First pin overlaps the boundary and has data, read in extent
+          * and rewrite portion prior to size */
          return read_pin(
            ctx,
            pin.duplicate()
@@ -548,6 +553,7 @@ ObjectDataHandler::truncate_ret ObjectDataHandler::truncate(
   context_t ctx,
   objaddr_t offset)
 {
+  offset = p2roundup(offset, ctx.tm.get_block_size());
   return with_object_data(
     ctx,
     [this, ctx, offset](auto &object_data) {