]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: initialize crc *after* read
authorSamuel Just <sjust@redhat.com>
Fri, 21 Aug 2020 20:15:21 +0000 (13:15 -0700)
committerSamuel Just <sjust@redhat.com>
Wed, 23 Sep 2020 22:13:51 +0000 (15:13 -0700)
Previously, all extents ended up initialized to the same crc value
upon read -- the one for an empty buffer.  This bug wasn't detected
because an extent was always evicted and reread following the first
write and subsequently kept in cache once initially written.

Also, add crc to operator<< for extents.

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

index f57f1df67df1b0a510ffce8a725c09ec9d401921..ef80bf1961cbc7cfb63a04c04224c1bd9fa68903 100644 (file)
@@ -135,14 +135,14 @@ public:
       ref->set_paddr(offset);
       ref->state = CachedExtent::extent_state_t::CLEAN;
 
-      /* TODO: crc should be checked against LBA manager */
-      ref->last_committed_crc = ref->get_crc32c();
-
       return segment_manager.read(
        offset,
        length,
        ref->get_bptr()).safe_then(
          [this, ref=std::move(ref)]() mutable {
+           /* TODO: crc should be checked against LBA manager */
+           ref->last_committed_crc = ref->get_crc32c();
+
            ref->on_clean_read();
            ref->complete_io();
            add_extent(ref);
index 4d632c0d296c553864f57481481d401f249415e6..e242d17499600ab18af2da973113eb7291318c72 100644 (file)
@@ -120,6 +120,7 @@ public:
        << ", version=" << version
        << ", paddr=" << get_paddr()
        << ", state=" << state
+       << ", last_committed_crc=" << last_committed_crc
        << ", refcount=" << use_count();
     print_detail(out);
     return out << ")";