]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
common/mempool: tolerate sum < 0 14982/head
authorSage Weil <sage@redhat.com>
Tue, 30 Oct 2018 20:35:23 +0000 (15:35 -0500)
committerSage Weil <sage@redhat.com>
Tue, 30 Oct 2018 20:35:23 +0000 (15:35 -0500)
commit02949bb37d714a65183e89810e731713933d055c
treef323626122db2e1b148d660ebc84a57e039ef4e1
parentc3c1393882d4d4bf453c92edb4f0812d117d28a1
common/mempool: tolerate sum < 0

If we are adding up the shards, and race with some allocations and
deallocations, we might get a negative sum.  E.g., with 2 shards, intially
[0,0],

- A: read shard 0 (0)
- B: allocate object on shard 0 (now 1)
- C: dallocate object on shard 1 (now -1)
- A: read shard 1 (-1)
- A: sum is -1

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/mempool.cc