Skip to content

Commit

Permalink
libceph: fix broken data length assertions
Browse files Browse the repository at this point in the history
It's OK for the result of a read to come back with fewer bytes than
were requested.  So don't trigger a BUG() in that case when
initializing the data cursor.

This resolves the first problem described in:
    http://tracker.ceph.com/issues/4598

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
  • Loading branch information
Alex Elder authored and Sage Weil committed May 2, 2013
1 parent 6644ed7 commit 1190bf0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/ceph/messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ static void ceph_msg_data_pages_cursor_init(struct ceph_msg_data *data,

BUG_ON(!data->pages);
BUG_ON(!data->length);
BUG_ON(length != data->length);
BUG_ON(length > data->length); /* short reads are OK */

cursor->resid = length;
page_count = calc_pages_for(data->alignment, (u64)data->length);
Expand Down Expand Up @@ -905,7 +905,7 @@ static void ceph_msg_data_pagelist_cursor_init(struct ceph_msg_data *data,

pagelist = data->pagelist;
BUG_ON(!pagelist);
BUG_ON(length != pagelist->length);
BUG_ON(length > pagelist->length); /* short reads are OK */

if (!length)
return; /* pagelist can be assigned but empty */
Expand Down

0 comments on commit 1190bf0

Please sign in to comment.