]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
libceph: account for alignment in pages cursor
authorAlex Elder <elder@inktank.com>
Sun, 31 Mar 2013 04:46:55 +0000 (23:46 -0500)
committerAlex Elder <elder@inktank.com>
Sun, 31 Mar 2013 04:59:15 +0000 (23:59 -0500)
commitddcb7527662504b8f676df8950527218ce109680
treeaa936aaea87eb15cd59c02bb3618a218d8d35e1e
parentc8dd1537c830ebb9ede8e96c9af44ea5e2a7a80f
libceph: account for alignment in pages cursor

When a cursor for a page array data message is initialized it needs
to determine the initial value for cursor->last_piece.  Currently it
just checks if length is less than a page, but that's not correct.
The data in the first page in the array will be offset by a page
offset based on the alignment recorded for the data.  (All pages
thereafter will be aligned at the base of the page, so there's
no need to account for this except for the first page.)

Because this was wrong, there was a case where the length of a piece
would be calculated as all of the residual bytes in the message and
that plus the page offset could exceed the length of a page.

So fix this case.  Make sure the sum won't wrap.

This resolves a third issue described in:
    http://tracker.ceph.com/issues/4598

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
net/ceph/messenger.c