mirror of
https://github.com/ceph/ceph
synced 2025-03-22 10:17:23 +00:00
Merge PR #24701 into master
* refs/pull/24701/head: os/bluestore: fix race between SharedBlobSet::lookup and SharedBlob::put Reviewed-by: Igor Fedotov <ifedotov@suse.com>
This commit is contained in:
commit
0638eb1aa4
src/os/bluestore
@ -1622,8 +1622,10 @@ void BlueStore::SharedBlob::put()
|
||||
if (coll_snap != coll) {
|
||||
goto again;
|
||||
}
|
||||
coll_snap->shared_blob_set.remove(this);
|
||||
|
||||
if (!coll_snap->shared_blob_set.remove(this, true)) {
|
||||
// race with lookup
|
||||
return;
|
||||
}
|
||||
bc._clear(coll_snap->cache);
|
||||
coll_snap->cache->rm_blob();
|
||||
}
|
||||
|
@ -461,15 +461,19 @@ public:
|
||||
sb->coll = coll;
|
||||
}
|
||||
|
||||
void remove(SharedBlob *sb) {
|
||||
bool remove(SharedBlob *sb, bool verify_nref_is_zero=false) {
|
||||
std::lock_guard l(lock);
|
||||
ceph_assert(sb->get_parent() == this);
|
||||
if (verify_nref_is_zero && sb->nref != 0) {
|
||||
return false;
|
||||
}
|
||||
// only remove if it still points to us
|
||||
auto p = sb_map.find(sb->get_sbid());
|
||||
if (p != sb_map.end() &&
|
||||
p->second == sb) {
|
||||
sb_map.erase(p);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool empty() {
|
||||
|
Loading…
Reference in New Issue
Block a user