Project

General

Profile

Actions

Bug #53678

closed
IF GB

NCB's reconstruct allocations improperly handles shared blobb

Bug #53678: NCB's reconstruct allocations improperly handles shared blobb

Added by Igor Fedotov almost 5 years ago. Updated over 1 year ago.

Status:
Resolved
Priority:
Normal
Target version:
-
Due date:
% Done:

0%

Source:
Backport:
quincy
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Tags (freeform):
Fixed In:
v17.0.0-10545-ge84992348e
Released In:
v18.2.0~2755
Upkeep Timestamp:
2025-07-14T15:49:25+00:00

Description

One might get the following assertion on fsck/startup when it keeps tons of shared blobs and previously crashed due to no space error.

../src/os/bluestore/fastbmap_allocator_impl.h: 809: FAILED ceph_assert(available >= allocated)

ceph version Development (no_version) quincy (dev)
1: (ceph::__ceph_assert_fail(char const*, char const*, int, char const*)+0x14c) [0x7f484ea021fb]
2: /home/if/ceph.2/build/lib/libceph-common.so.2(+0x25c40c) [0x7f484ea0240c]
3: (BitmapAllocator::init_rm_free(unsigned long, unsigned long)+0x709) [0x55c0f2ae1f39]
4: (BlueStore::read_allocation_from_single_onode(Allocator*, boost::intrusive_ptr<BlueStore::Onode>&, BlueStore::read_alloc_stats_t&)+0x103) [0x55c0f28f5d33]
5: (BlueStore::read_allocation_from_onodes(Allocator*, BlueStore::read_alloc_stats_t&)+0xd31) [0x55c0f29309a1]
6: (BlueStore::reconstruct_allocations(Allocator*, BlueStore::read_alloc_stats_t&)+0x520) [0x55c0f2931a00]
7: (BlueStore::read_allocation_from_drive_on_startup()+0x96) [0x55c0f29485c6]
8: (BlueStore::_init_alloc(std::map<unsigned long, unsigned long, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, unsigned long> > >*)+0xac3) [0x55c0f29496b3]
9: (BlueStore::_open_db_and_around(bool, bool)+0x367) [0x55c0f2992727]
10: (BlueStore::_fsck(BlueStore::FSCKDepth, bool)+0x486) [0x55c0f29950f6]
11: main()

Adam's script from https://gist.github.com/aclamk/974db54b7613e074c6bbc4877a4d722e is a good reproducer. But please note OSD has to end up with ENOSPC error before getting this failure.

IMO the root cause is a design flaw in NCB code which feeds the same extent from a shared blob multiple times to NCB restore allocator - bitmap allocator silently accepts duplicate extents but improperly adjust available space multiple times which finally causes the assertion.
Generally allocators are not supposed to get the same extent in init_rm_free calls multiple times - it's an abuse of bitmap one which performs no checking for performance reasons and hence silently accepts that up to some point. E.g. AVL one would assert immediately..
I think the proper shared blob handling should be similar to fsck implementation and should involve standalone run over shared blob KV records to update allocator instead of handling shared blob on per-onode basis.


Related issues 1 (0 open — 1 closed)

Copied to bluestore - Backport #54175: quincy: NCB's reconstruct allocations improperly handles shared blobbResolvedGabriel BenHanokh

Actions

IF Updated by Igor Fedotov almost 5 years ago Actions #1

Here is a log snippet showing duplicate init_rm_free calls (see lba = 0xa8c4a000)
-24> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free 0xa8c44000~1000
-23> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free done
-22> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free 0xa8c46000~2000
-21> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free done
-20> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free 0x10ff976000~1000
-19> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free done
-18> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free 0x10ee606000~1000
-17> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free done
-16> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free 0xa8c4a000~6000
-15> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free done
-14> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free 0xa8c53000~2000
-13> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free done
-12> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free 0xa8c56000~3000
-11> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free done
-10> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free 0xf8a921000~1000
-9> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free done
-8> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free 0xf4ba61000~1000
-7> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free done
-6> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free 0xfecb5d000~1000
-5> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free done
-4> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free 0xa8c4a000~6000
-3> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free done
-2> 2021-12-20T23:05:08.449+0300 7f484dde7380 10 fbmap_alloc 0x55c0f5731680 init_rm_free 0xa8c53000~2000

NO Updated by Neha Ojha almost 5 years ago Actions #2

  • Status changed from New to Fix Under Review
  • Pull request ID set to 44563

NO Updated by Neha Ojha almost 5 years ago Actions #3

  • Status changed from Fix Under Review to Resolved

GB Updated by Gabriel BenHanokh almost 5 years ago Actions #4

  • Backport set to quincy

GB Updated by Gabriel BenHanokh almost 5 years ago Actions #5

  • Status changed from Resolved to Pending Backport

UB Updated by Upkeep Bot almost 5 years ago Actions #6

  • Copied to Backport #54175: quincy: NCB's reconstruct allocations improperly handles shared blobb added

NO Updated by Neha Ojha almost 5 years ago Actions #7

  • Status changed from Pending Backport to Resolved

UB Updated by Upkeep Bot over 1 year ago Actions #8

  • Merge Commit set to e84992348e37be6115e51b2688761b9c0d7f009c
  • Fixed In set to v17.0.0-10545-ge84992348e
  • Released In set to v18.2.0~2755
  • Upkeep Timestamp set to 2025-07-14T15:49:25+00:00
Actions

Also available in: PDF Atom