]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: fix potential access violation
authorxie xingguo <xie.xingguo@zte.com.cn>
Fri, 29 Jul 2016 03:09:00 +0000 (11:09 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Fri, 29 Jul 2016 03:13:48 +0000 (11:13 +0800)
According to BlueFS::_init_alloc(), if the relevant bdev
does not exist, we will skip initializing the corresponding
allocator too.

So below here we shall check the existence of the specific
allocator instead.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/bluestore/BlueFS.cc

index f8e3dc1d4429809e9353a75302ed62fae6734bd4..8fe5e80463d1700ea3d23f34bf1f22e9b223f169 100644 (file)
@@ -144,7 +144,7 @@ void BlueFS::add_block_extent(unsigned id, uint64_t offset, uint64_t length)
   block_all[id].insert(offset, length);
   block_total[id] += length;
 
-  if (alloc.size()) {
+  if (id < alloc.size() && alloc[id]) {
     log_t.op_alloc_add(id, offset, length);
     int r = _flush_and_sync_log(l);
     assert(r == 0);