]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: special case CALL op to not have RD bit effects
authorSage Weil <sage@inktank.com>
Sat, 5 Jan 2013 01:43:41 +0000 (17:43 -0800)
committerSage Weil <sage@inktank.com>
Sat, 5 Jan 2013 04:46:56 +0000 (20:46 -0800)
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>
src/include/rados.h
src/osdc/Objecter.cc

index 073ad62bd5feeadbc1c1e519a0a460a64883cbaf..4f7d7174c47b57db095bad845c034ccf5848270e 100644 (file)
@@ -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)
 {
index 6abada8f5d8fffc030363bc7a60fbf0529e78bf2..04a74b87b66bace753ae69e9f7b3afa1b3eeb940 100644 (file)
@@ -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;