summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-01-04 17:43:41 -0800
committerSage Weil <sage@inktank.com>2013-01-04 20:46:56 -0800
commit988a52173522e9a410ba975a4e8b7c25c7801123 (patch)
treeaaa0b4ce7876c342b7ad3533400872786115b043
parentd3abd0fe0bb402ff403259d4b1a718a56331fc39 (diff)
downloadceph-988a52173522e9a410ba975a4e8b7c25c7801123.tar.gz
osd: special case CALL op to not have RD bit effects
In commit 20496b8d2b2c3779a771695c6f778abbdb66d92a we treat a CALL as different from a normal "read", but we did not adjust the behavior determined by the RD bit in the op. We tried to fix that in 91e941aef9f55425cc12204146f26d79c444cfae, but changing the op code breaks compatibility, so that was reverted. Instead, special-case CALL in the helper--the only point in the code that actually checks for the RD bit. (And fix one lingering user to use that helper appropriately.) Fixes: #3731 Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Dan Mick <dan.mick@inktank.com>
-rw-r--r--src/include/rados.h8
-rw-r--r--src/osdc/Objecter.cc2
2 files changed, 8 insertions, 2 deletions
diff --git a/src/include/rados.h b/src/include/rados.h
index 073ad62bd5f..4f7d7174c47 100644
--- a/src/include/rados.h
+++ b/src/include/rados.h
@@ -141,6 +141,10 @@ extern const char *ceph_osd_state_name(int s);
/*
* osd ops
+ *
+ * WARNING: do not use these op codes directly. Use the helpers
+ * defined below instead. In certain cases, op code behavior was
+ * redefined, resulting in special-cases in the helpers.
*/
#define CEPH_OSD_OP_MODE 0xf000
#define CEPH_OSD_OP_MODE_RD 0x1000
@@ -244,6 +248,7 @@ enum {
CEPH_OSD_OP_DNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 6,
/** exec **/
+ /* note: the RD bit here is wrong; see special-case below in helper */
CEPH_OSD_OP_CALL = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_EXEC | 1,
/** pg **/
@@ -282,7 +287,8 @@ static inline int ceph_osd_op_mode_subop(int op)
}
static inline int ceph_osd_op_mode_read(int op)
{
- return op & CEPH_OSD_OP_MODE_RD;
+ return (op & CEPH_OSD_OP_MODE_RD) &&
+ op != CEPH_OSD_OP_CALL;
}
static inline int ceph_osd_op_mode_modify(int op)
{
diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc
index 6abada8f5d8..04a74b87b66 100644
--- a/src/osdc/Objecter.cc
+++ b/src/osdc/Objecter.cc
@@ -1287,7 +1287,7 @@ int Objecter::calc_op_budget(Op *op)
++i) {
if (i->op.op & CEPH_OSD_OP_MODE_WR) {
op_budget += i->indata.length();
- } else if (i->op.op & CEPH_OSD_OP_MODE_RD) {
+ } else if (ceph_osd_op_mode_read(i->op.op)) {
if (ceph_osd_op_type_data(i->op.op)) {
if ((int64_t)i->op.extent.length > 0)
op_budget += (int64_t)i->op.extent.length;