All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libceph: fix broken data length assertions
@ 2013-03-30 19:34 Alex Elder
  2013-03-31  1:00 ` Sage Weil
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Elder @ 2013-03-30 19:34 UTC (permalink / raw)
  To: ceph-devel@vger.kernel.org

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:
    http://tracker.ceph.com/issues/4598

Signed-off-by: Alex Elder <elder@inktank.com>
---
 net/ceph/messenger.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index d4e46d8..24f3aba 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,

 	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);
@@ -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 */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-31  1:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-30 19:34 [PATCH] libceph: fix broken data length assertions Alex Elder
2013-03-31  1:00 ` Sage Weil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.