]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: fix incomplete faulty range marking when doing compression 22910/head
authorIgor Fedotov <ifedotov@suse.com>
Thu, 5 Jul 2018 11:27:12 +0000 (14:27 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Fri, 6 Jul 2018 16:26:50 +0000 (19:26 +0300)
GC.

Under some scenarios GC might process an extent range where some inner extents are left untouched by GC (as there is no need for that). Hence GC doesn't invaliate these inner extents with fault_range call. If untouched extents are mapped to unloaded shards it results in subsequent assertion on o->extent_map.dirty_range() call.
The solution is to invalidate the whole extent range when doing GC.

Fixes: https://tracker.ceph.com/issues/23540
Fixes: https://tracker.ceph.com/issues/24799
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
(cherry picked from commit 0f04d4484c8663767bdb60f743a8835897013b5a)

src/os/bluestore/BlueStore.cc

index e205baff3d61d5b8c69fbf007d6610022ca8a4f7..ade6eafb56951a7beb1ea093bbbddff0f273d20d 100644 (file)
@@ -10934,6 +10934,7 @@ int BlueStore::_do_gc(
 {
   auto& extents_to_collect = gc.get_extents_to_collect();
 
+  bool dirty_range_updated = false;
   WriteContext wctx_gc;
   wctx_gc.fork(wctx); // make a clone for garbage collection
 
@@ -10950,12 +10951,17 @@ int BlueStore::_do_gc(
 
     if (*dirty_start > it->offset) {
       *dirty_start = it->offset;
+      dirty_range_updated = true;
     }
 
     if (*dirty_end < it->offset + it->length) {
       *dirty_end = it->offset + it->length;
+      dirty_range_updated = true;
     }
   }
+  if (dirty_range_updated) {
+    o->extent_map.fault_range(db, *dirty_start, *dirty_end);
+  }
 
   dout(30) << __func__ << " alloc write" << dendl;
   int r = _do_alloc_write(txc, c, o, &wctx_gc);
@@ -11037,9 +11043,10 @@ int BlueStore::_do_write(
              << dendl;
         goto out;
       }
+      dout(20)<<__func__<<" gc range is " << std::hex << dirty_start
+             << "~" << dirty_end - dirty_start << std::dec << dendl;
     }
   }
-
   o->extent_map.compress_extent_map(dirty_start, dirty_end - dirty_start);
   o->extent_map.dirty_range(dirty_start, dirty_end - dirty_start);