From: Haomai Wang Date: Mon, 23 Oct 2017 08:25:09 +0000 (+0800) Subject: os/ObjectStore: fix get_data_alignment return -1 causing problem in msg header X-Git-Tag: v13.0.1~435^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F18475%2Fhead;p=ceph.git os/ObjectStore: fix get_data_alignment return -1 causing problem in msg header 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 --- diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index 65df8ec08ebc..9eff1ff0db14 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -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)