Actions
Bug #50031
openosdc _throttle_op function param type of op_budget int is too small
% Done:
0%
Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
Ceph - v12.2.1, Ceph - v12.2.10, Ceph - v12.2.11, Ceph - v12.2.12, Ceph - v12.2.13, Ceph - v12.2.14, Ceph - v12.2.2, Ceph - v12.2.3, Ceph - v12.2.4, Ceph - v12.2.5, Ceph - v12.2.6, Ceph - v12.2.7, Ceph - v12.2.8, Ceph - v12.2.9, Ceph - v13.0.0, Ceph - v13.2.0, Ceph - v13.2.1, Ceph - v13.2.10, Ceph - v13.2.11, Ceph - v13.2.2, Ceph - v13.2.3, Ceph - v13.2.4, Ceph - v13.2.5, Ceph - v13.2.6, Ceph - v13.2.7, Ceph - v13.2.8, Ceph - v13.2.9, Ceph - v14.0.0, Ceph - v14.2.0, Ceph - v14.2.1, Ceph - v14.2.10, Ceph - v14.2.11, Ceph - v14.2.12, Ceph - v14.2.13, Ceph - v14.2.14, Ceph - v14.2.15, Ceph - v14.2.16, Ceph - v14.2.17, Ceph - v14.2.18, Ceph - v14.2.19, Ceph - v14.2.2, Ceph - v14.2.3, Ceph - v14.2.4, Ceph - v14.2.5, Ceph - v14.2.6, Ceph - v14.2.7, Ceph - v14.2.8, Ceph - v14.2.9, Ceph - v15.0.0, Ceph - v15.2.1, Ceph - v15.2.10, Ceph - v15.2.11, Ceph - v15.2.2, Ceph - v15.2.3, Ceph - v15.2.4, Ceph - v15.2.5, Ceph - v15.2.6, Ceph - v15.2.7, Ceph - v15.2.8, Ceph - v15.2.9, Ceph - v16.0.0, Ceph - v16.0.1, Ceph - v16.1.0, Ceph - v16.1.1, Ceph - v17.0.0
ceph-qa-suite:
Component(RADOS):
Pull request ID:
Crash signature (v1):
Crash signature (v2):
Description
problem¶
1. function calc_op_budget return type is int,when indata.length() is out of int range, it will return a negative number.
int Objecter::calc_op_budget(const bc::small_vector_base<OSDOp>& ops) { int op_budget = 0; for (auto i = ops.begin(); i != ops.end(); ++i) { if (i->op.op & CEPH_OSD_OP_MODE_WR) { op_budget += i->indata.length(); } else if (ceph_osd_op_mode_read(i->op.op)) { if (ceph_osd_op_uses_extent(i->op.op)) { if ((int64_t)i->op.extent.length > 0) op_budget += (int64_t)i->op.extent.length; } else if (ceph_osd_op_type_attr(i->op.op)) { op_budget += i->op.xattr.name_len + i->op.xattr.value_len; } } } return op_budget; } void Objecter::_throttle_op(Op *op, shunique_lock<ceph::shared_mutex>& sul, int op_budget) { ceph_assert(sul && sul.mutex() == &rwlock); bool locked_for_write = sul.owns_lock(); if (!op_budget) op_budget = calc_op_budget(op->ops); if (!op_throttle_bytes.get_or_fail(op_budget)) { //couldn't take right now sul.unlock(); op_throttle_bytes.get(op_budget); if (locked_for_write) sul.lock(); else sul.lock_shared(); } if (!op_throttle_ops.get_or_fail(1)) { //couldn't take right now sul.unlock(); op_throttle_ops.get(1); if (locked_for_write) sul.lock(); else sul.lock_shared(); } }
2. and negative value will fail at assert
bool Throttle::get_or_fail(int64_t c) { if (0 == max) { return true; } assert (c >= 0); // will fail Mutex::Locker l(lock); ... ... }
How to reproduce¶
1. rados set omap with a 3GB file
$ rados -p default.rgw.log setomapval init.log key < 3GB.zip
Updated by Sage Weil almost 3 years ago
- Project changed from Ceph to RADOS
- Category deleted (
Objecter)
Actions