]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/cache: don't mark invalid extents clean
authorSamuel Just <sjust@redhat.com>
Thu, 6 Aug 2020 00:03:31 +0000 (17:03 -0700)
committerSamuel Just <sjust@redhat.com>
Thu, 13 Aug 2020 18:32:31 +0000 (11:32 -0700)
In the event that an extent is created and removed in the same
transaction (invalid extent in fresh_block_list), update
block specific metadata but don't add to cache and especially
do not mark clean.  LBAManager::complete_commit implementations
are meant to use skip based on state in the same way.

Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/os/seastore/cache.cc

index d77ffde8864d92cfcb8f0d40cc531e2beea7a809..2e7855651abbd7a196c1fc8611a1c49896775a4b 100644 (file)
@@ -187,10 +187,16 @@ void Cache::complete_commit(
   for (auto &i: t.fresh_block_list) {
     i->set_paddr(cur);
     cur.offset += i->get_length();
-    i->state = CachedExtent::extent_state_t::CLEAN;
     i->last_committed_crc = i->get_crc32c();
-    logger().debug("complete_commit: fresh {}", *i);
     i->on_initial_write();
+
+    if (!i->is_valid()) {
+      logger().debug("complete_commit: invalid {}", *i);
+      continue;
+    }
+
+    i->state = CachedExtent::extent_state_t::CLEAN;
+    logger().debug("complete_commit: fresh {}", *i);
     add_extent(i);
   }