diff options
author | Alex Elder <elder@inktank.com> | 2013-03-30 14:31:02 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-02 00:17:38 -0400 |
commit | 1190bf06a6b033384a65b5acdb1193d41cd257a6 (patch) | |
tree | dd954da4bce3965e9255218b1908b0a9789d3cb2 | |
parent | 6644ed7b7e04f8e588aebdaa58cededb9416ab95 (diff) |
libceph: fix broken data length assertions
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>
-rw-r--r-- | net/ceph/messenger.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index d4e46d8a088c..24f3aba34800 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -833,7 +833,7 @@ static void ceph_msg_data_pages_cursor_init(struct ceph_msg_data *data, | |||
833 | 833 | ||
834 | BUG_ON(!data->pages); | 834 | BUG_ON(!data->pages); |
835 | BUG_ON(!data->length); | 835 | BUG_ON(!data->length); |
836 | BUG_ON(length != data->length); | 836 | BUG_ON(length > data->length); /* short reads are OK */ |
837 | 837 | ||
838 | cursor->resid = length; | 838 | cursor->resid = length; |
839 | page_count = calc_pages_for(data->alignment, (u64)data->length); | 839 | page_count = calc_pages_for(data->alignment, (u64)data->length); |
@@ -905,7 +905,7 @@ static void ceph_msg_data_pagelist_cursor_init(struct ceph_msg_data *data, | |||
905 | 905 | ||
906 | pagelist = data->pagelist; | 906 | pagelist = data->pagelist; |
907 | BUG_ON(!pagelist); | 907 | BUG_ON(!pagelist); |
908 | BUG_ON(length != pagelist->length); | 908 | BUG_ON(length > pagelist->length); /* short reads are OK */ |
909 | 909 | ||
910 | if (!length) | 910 | if (!length) |
911 | return; /* pagelist can be assigned but empty */ | 911 | return; /* pagelist can be assigned but empty */ |