]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/ObjectStore: fix get_data_alignment return -1 causing problem in msg header 18475/head
authorHaomai Wang <haomai@xsky.com>
Mon, 23 Oct 2017 08:25:09 +0000 (16:25 +0800)
committerHaomai Wang <haomai@xsky.com>
Mon, 23 Oct 2017 08:49:22 +0000 (16:49 +0800)
sizeof(data_off) in ceph_msg_header is uint16_t, so -1 will be 65535. When peer
side receive MOSDRepOp message, it will allocate extra 1 byte buffer to store
nonexisted buffer.

Signed-off-by: Haomai Wang <haomai@xsky.com>
src/os/ObjectStore.h

index 65df8ec08ebcfb8d14675bc7f229e2153c9bd047..9eff1ff0db14b3d59aa12419d2deabc2d912955b 100644 (file)
@@ -853,7 +853,7 @@ public:
     /// offset of buffer as aligned to destination within object.
     int get_data_alignment() {
       if (!data.largest_data_len)
-       return -1;
+       return 0;
       return (0 - get_data_offset()) & ~CEPH_PAGE_MASK;
     }
     /// Is the Transaction empty (no operations)