From patchwork Sat Mar 30 19:34:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2368011 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id AE54DDF24C for ; Sat, 30 Mar 2013 19:34:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757164Ab3C3TeJ (ORCPT ); Sat, 30 Mar 2013 15:34:09 -0400 Received: from mail-qa0-f48.google.com ([209.85.216.48]:61527 "EHLO mail-qa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757011Ab3C3TeI (ORCPT ); Sat, 30 Mar 2013 15:34:08 -0400 Received: by mail-qa0-f48.google.com with SMTP id hu16so356690qab.7 for ; Sat, 30 Mar 2013 12:34:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding:x-gm-message-state; bh=/bvHrKrbnbdByWdm/KffkMFJCArOgfqfdcL4WNtY/TY=; b=MZvAIyTpcbIdf5DsaiNXTdSgu0Vx6eS9R7j4z567SWYJ6H6Rbk40qBXGAv/leESHKk z5TGReRhDq6Egd44PnKxrqVUczGeB/yGJzSL9w4AuBR4s9X99JgLkmTeoKdmSdQsW56/ vkNF+n9IbxOfqv1KyR8wQVKNnASKA8l7yEiiBG9asejAZP7+oWfDiYN9/SR2xflcOU8I Jm0AyNs16g6fxgsUgIi81CVhnugPV3xNVNDYBpg5qkQ4g1xlOO9xhD5m8NaRWqveZPG9 4zGnBOEX4EvMTo3B8o1nSPTRuuEBQCJRYHhD69EPISBU9xFIAKIcq7CREW+8c+DLFiVC vi9g== X-Received: by 10.49.16.233 with SMTP id j9mr8754251qed.12.1364672047805; Sat, 30 Mar 2013 12:34:07 -0700 (PDT) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPS id gw9sm13646878qab.10.2013.03.30.12.34.06 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 30 Mar 2013 12:34:07 -0700 (PDT) Message-ID: <51573E2E.5090406@inktank.com> Date: Sat, 30 Mar 2013 14:34:06 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 To: "ceph-devel@vger.kernel.org" Subject: [PATCH] libceph: fix broken data length assertions X-Gm-Message-State: ALoCoQlAAWFiGURxRHUQOx13MZa9vipLiwNgkZiC0jNmgtgGkcCkvIeuY7SKRO9rgXiyNEdg63M9 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: 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 Reviewed-by: Sage Weil --- net/ceph/messenger.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 */ 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;