]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: check assertion inside apply_for_bitset_range
authorIgor Fedotov <ifedotov@suse.com>
Mon, 18 Nov 2019 09:35:09 +0000 (12:35 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Mon, 18 Nov 2019 09:53:00 +0000 (12:53 +0300)
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueStore.cc
src/os/bluestore/bluestore_common.h

index 6de7df5f4918d4eeff7cdb3bfdc12f46a4f72fdf..7f9a2f573b11189b0ca58ba03353f0fc7b41cb49 100644 (file)
@@ -769,7 +769,6 @@ int BlueFS::_check_new_allocations(const bluefs_fnode_t& fnode,
     ceph_assert(id < dev_count);
     apply_for_bitset_range(e.offset, e.length, alloc_size[id], owned_blocks[id],
       [&](uint64_t pos, boost::dynamic_bitset<uint64_t> &bs) {
-        ceph_assert(pos < bs.size());
         if (!bs.test(pos)) {
           fail = true;
         }
@@ -786,7 +785,6 @@ int BlueFS::_check_new_allocations(const bluefs_fnode_t& fnode,
 
     apply_for_bitset_range(e.offset, e.length, alloc_size[id], used_blocks[id],
       [&](uint64_t pos, boost::dynamic_bitset<uint64_t> &bs) {
-        ceph_assert(pos < bs.size());
         if (bs.test(pos)) {
           fail = true;
         }
@@ -1030,7 +1028,6 @@ int BlueFS::_replay(bool noop, bool to_stdout)
               bool fail = false;
               apply_for_bitset_range(offset, length, alloc_size[id], owned_blocks[id],
                 [&](uint64_t pos, boost::dynamic_bitset<uint64_t> &bs) {
-                  ceph_assert(pos < bs.size());
                   if (bs.test(pos)) {
                     fail = true;
                   } else {
@@ -1046,8 +1043,6 @@ int BlueFS::_replay(bool noop, bool to_stdout)
               }
               apply_for_bitset_range(offset, length, alloc_size[id], used_blocks[id],
                 [&](uint64_t pos, boost::dynamic_bitset<uint64_t> &bs) {
-                  ceph_assert(pos < bs.size());
-                  
                   if (bs.test(pos)) {
                     fail = true;
                   }
@@ -1089,7 +1084,6 @@ int BlueFS::_replay(bool noop, bool to_stdout)
               bool fail = false;
               apply_for_bitset_range(offset, length, alloc_size[id], owned_blocks[id],
                 [&](uint64_t pos, boost::dynamic_bitset<uint64_t> &bs) {
-                  ceph_assert(pos < bs.size());
                   if (!bs.test(pos)) {
                     fail = true;
                   } else {
@@ -1106,7 +1100,6 @@ int BlueFS::_replay(bool noop, bool to_stdout)
 
               apply_for_bitset_range(offset, length, alloc_size[id], used_blocks[id],
                 [&](uint64_t pos, boost::dynamic_bitset<uint64_t> &bs) {
-                  ceph_assert(pos < bs.size());
                   if (bs.test(pos)) {
                     fail = true;
                   }
@@ -1248,7 +1241,6 @@ int BlueFS::_replay(bool noop, bool to_stdout)
                 auto id = e.bdev;
                 apply_for_bitset_range(e.offset, e.length, alloc_size[id], used_blocks[id],
                   [&](uint64_t pos, boost::dynamic_bitset<uint64_t> &bs) {
-                    ceph_assert(pos < bs.size());
                     ceph_assert(bs.test(pos));
                     bs.reset(pos);
                   }
@@ -1292,7 +1284,6 @@ int BlueFS::_replay(bool noop, bool to_stdout)
                 bool fail = false;
                 apply_for_bitset_range(e.offset, e.length, alloc_size[id], owned_blocks[id],
                   [&](uint64_t pos, boost::dynamic_bitset<uint64_t> &bs) {
-                    ceph_assert(pos < bs.size());
                     if (!bs.test(pos)) {
                       fail = true;
                     }
@@ -1309,7 +1300,6 @@ int BlueFS::_replay(bool noop, bool to_stdout)
 
                 apply_for_bitset_range(e.offset, e.length, alloc_size[id], used_blocks[id],
                   [&](uint64_t pos, boost::dynamic_bitset<uint64_t> &bs) {
-                    ceph_assert(pos < bs.size());
                     if (!bs.test(pos)) {
                       fail = true;
                     }
index f6ccca88047fe9357ebb7e7b09cd0771e23bd786..8bd4eb8479ed819bf1ab9a2f207d9fcdd5269207 100644 (file)
@@ -7026,7 +7026,6 @@ int BlueStore::_fsck_check_extents(
       apply_for_bitset_range(
         e.offset, e.length, granularity, used_blocks,
         [&](uint64_t pos, mempool_dynamic_bitset &bs) {
-         ceph_assert(pos < bs.size());
          if (bs.test(pos)) {
            if (repairer) {
              repairer->note_misreference(
@@ -8086,7 +8085,6 @@ int BlueStore::_fsck_on_open(BlueStore::FSCKDepth depth, bool repair)
   apply_for_bitset_range(
     0, std::max<uint64_t>(min_alloc_size, SUPER_RESERVED), fm->get_alloc_size(), used_blocks,
     [&](uint64_t pos, mempool_dynamic_bitset &bs) {
-       ceph_assert(pos < bs.size());
       bs.set(pos);
     }
   );
@@ -8127,7 +8125,6 @@ int BlueStore::_fsck_on_open(BlueStore::FSCKDepth depth, bool repair)
       apply_for_bitset_range(
         e.get_start(), e.get_len(), fm->get_alloc_size(), used_blocks,
         [&](uint64_t pos, mempool_dynamic_bitset &bs) {
-       ceph_assert(pos < bs.size());
           bs.set(pos);
         }
        );
@@ -8601,7 +8598,6 @@ int BlueStore::_fsck_on_open(BlueStore::FSCKDepth depth, bool repair)
           apply_for_bitset_range(
             e.get_start(), e.get_len(), fm->get_alloc_size(), used_blocks,
             [&](uint64_t pos, mempool_dynamic_bitset &bs) {
-         ceph_assert(pos < bs.size());
               bs.set(pos);
             }
           );
@@ -8617,7 +8613,6 @@ int BlueStore::_fsck_on_open(BlueStore::FSCKDepth depth, bool repair)
         apply_for_bitset_range(
           e.get_start(), e.get_len(), fm->get_alloc_size(), used_blocks,
           [&](uint64_t pos, mempool_dynamic_bitset &bs) {
-           ceph_assert(pos < bs.size());
            bs.reset(pos);
           }
         );
@@ -8629,7 +8624,6 @@ int BlueStore::_fsck_on_open(BlueStore::FSCKDepth depth, bool repair)
         apply_for_bitset_range(
           offset, length, fm->get_alloc_size(), used_blocks,
           [&](uint64_t pos, mempool_dynamic_bitset &bs) {
-           ceph_assert(pos < bs.size());
             if (bs.test(pos)) {
              if (offset == SUPER_RESERVED &&
                  length == min_alloc_size - SUPER_RESERVED) {
index 876a9c2b24fb1aea8fee33052d48285027ec4e62..764574af59b978c9d85757bbd9eb8f08be2a349c 100755 (executable)
@@ -16,6 +16,7 @@
 #define CEPH_OSD_BLUESTORE_COMMON_H
 
 #include "include/intarith.h"
+#include "include/ceph_assert.h"
 
 template <class Bitset, class Func>
 void apply_for_bitset_range(uint64_t off,
@@ -26,6 +27,7 @@ void apply_for_bitset_range(uint64_t off,
   auto end = round_up_to(off + len, granularity);
   while (off < end) {
     uint64_t pos = off / granularity;
+    ceph_assert(pos < bitset.size());
     f(pos, bitset);
     off += granularity;
   }