提交 9ef1ee5a 编写于 作者: A Alex Elder 提交者: Sage Weil

libceph: fix byte order mismatch

A WATCH op includes an object version.  The version that's supplied
is incorrectly byte-swapped osd_req_op_watch_init() where it's first
assigned (it's been this way since that code was first added).

The result is that the version sent to the osd is wrong, because
that value gets byte-swapped again in osd_req_encode_op().  This
is the source of a sparse warning related to improper byte order in
the assignment.

The approach of using the version to avoid a race is deprecated
(see http://tracker.ceph.com/issues/3871), and the watch parameter
is no longer even examined by the osd.  So fix the assignment in
osd_req_op_watch_init() so it no longer does the byte swap.

This resolves:
    http://tracker.ceph.com/issues/3847Signed-off-by: NAlex Elder <elder@inktank.com>
Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
上级 770eba6e
...@@ -577,8 +577,7 @@ void osd_req_op_watch_init(struct ceph_osd_request *osd_req, ...@@ -577,8 +577,7 @@ void osd_req_op_watch_init(struct ceph_osd_request *osd_req,
BUG_ON(opcode != CEPH_OSD_OP_NOTIFY_ACK && opcode != CEPH_OSD_OP_WATCH); BUG_ON(opcode != CEPH_OSD_OP_NOTIFY_ACK && opcode != CEPH_OSD_OP_WATCH);
op->watch.cookie = cookie; op->watch.cookie = cookie;
/* op->watch.ver = version; */ /* XXX 3847 */ op->watch.ver = version;
op->watch.ver = cpu_to_le64(version);
if (opcode == CEPH_OSD_OP_WATCH && flag) if (opcode == CEPH_OSD_OP_WATCH && flag)
op->watch.flag = (u8)1; op->watch.flag = (u8)1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册