]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: do not update used_blocks with bluefs_extents if bluefs is 36535/head
authorFeng Hualong <hualong.feng@intel.com>
Mon, 10 Aug 2020 03:10:55 +0000 (03:10 +0000)
committerFeng Hualong <hualong.feng@intel.com>
Wed, 12 Aug 2020 15:42:56 +0000 (15:42 +0000)
not available

When I disabled bluefs, the bluefs point is nullptr, but is still used.
It caused the problem:
*** Caught signal (Segmentation fault) **
 in thread 7f733db01d80 thread_name:ceph-osd
 ceph version 16.0.0-4201-g2ccd47711b (2ccd47711b73b09069e6964730532fc3cf6e7382) pacific (dev)
 1: (()+0x153c0) [0x7f733e1a73c0]
 2: (pthread_mutex_lock()+0x4) [0x7f733e19dfc4]
 3: (BlueFS::get_block_extents(unsigned int, interval_set<unsigned long, std::map>*)+0x40) [0x562384a57680]
 4: (BlueStore::_fsck_on_open(BlueStore::FSCKDepth, bool)+0x743) [0x5623849b1143]
 5: (BlueStore::_fsck(BlueStore::FSCKDepth, bool)+0x32a) [0x5623849be1da]
 6: (BlueStore::mkfs()+0xc77) [0x5623849c0967]
 7: (OSD::mkfs(ceph::common::CephContext*, ObjectStore*, uuid_d, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)+0x1b2) [0x5623843e85c2]
 8: (main()+0x1563) [0x56238436b3f3]
 9: (__libc_start_main()+0xf3) [0x7f733dc0e0b3]
 10: (_start()+0x2e) [0x5623843b734e]
2020-08-10T00:54:09.896+0000 7f733db01d80 -1 *** Caught signal (Segmentation fault) **
 in thread 7f733db01d80 thread_name:ceph-osd

 ceph version 16.0.0-4201-g2ccd47711b (2ccd47711b73b09069e6964730532fc3cf6e7382) pacific (dev)

Signed-off-by: Feng Hualong <hualong.feng@intel.com>
src/os/bluestore/BlueStore.cc

index 97c5acb66dde627371caed6febd068cb437c5f31..a43ffd5e468eff9d19dad1bf96aa9756ede10c0a 100644 (file)
@@ -8006,7 +8006,6 @@ int BlueStore::_fsck_on_open(BlueStore::FSCKDepth depth, bool repair)
   uint64_t num_sharded_objects = 0;
   BlueStoreRepairer repairer;
 
-  interval_set<uint64_t> bluefs_extents;
   auto alloc_size = fm->get_alloc_size();
 
   utime_t start = ceph_clock_now();
@@ -8014,16 +8013,19 @@ int BlueStore::_fsck_on_open(BlueStore::FSCKDepth depth, bool repair)
   _fsck_collections(&errors);
   used_blocks.resize(fm->get_alloc_units());
 
-  int r = bluefs->get_block_extents(bluefs_layout.shared_bdev, &bluefs_extents);
-  ceph_assert(r == 0);
-  for (interval_set<uint64_t>::iterator it = bluefs_extents.begin(); it != bluefs_extents.end(); ++it) {
+  if (bluefs) {
+    interval_set<uint64_t> bluefs_extents;
 
-    apply_for_bitset_range(it.get_start(), it.get_len(), alloc_size, used_blocks,
-      [&](uint64_t pos, mempool_dynamic_bitset& bs) {
-        ceph_assert(pos < bs.size());
-        bs.set(pos);
-      }
-    );
+    int r = bluefs->get_block_extents(bluefs_layout.shared_bdev, &bluefs_extents);
+    ceph_assert(r == 0);
+    for (auto [start, len] : bluefs_extents) {
+      apply_for_bitset_range(start, len, alloc_size, used_blocks,
+        [&](uint64_t pos, mempool_dynamic_bitset& bs) {
+          ceph_assert(pos < bs.size());
+          bs.set(pos);
+        }
+      );
+    }
   }
 
   bluefs_used_blocks = used_blocks;