From patchwork Sat Mar 9 16:03:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2241821 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 48D4F3FCF6 for ; Sat, 9 Mar 2013 16:03:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932735Ab3CIQDM (ORCPT ); Sat, 9 Mar 2013 11:03:12 -0500 Received: from mail-ie0-f169.google.com ([209.85.223.169]:46432 "EHLO mail-ie0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932692Ab3CIQDM (ORCPT ); Sat, 9 Mar 2013 11:03:12 -0500 Received: by mail-ie0-f169.google.com with SMTP id 13so3235325iea.14 for ; Sat, 09 Mar 2013 08:03:11 -0800 (PST) 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 :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=PuO3rNEI4n2T2hKvPCVP48LmYw4GtV67JulBdMgKtMI=; b=hmxrzUIRkYp88o9v+45R7khAjint6DB9yCDqVL3mbFDREmkZ02hpHK6gFLGMx8GgJ/ OS9LlO2xpU6+ehsZO0xF5PdapLNMiJBsOShTRCEFg+71RrsncS6g3jMRYjWcoBG3tVBN bLdrVPSXXcQ9cwabzc012XoGw9p2wkx0DVy3pCFYZXp/6Jpq234hmMexXTmC1mfxLmqK QY+lyqWfOds5RfjGIMMiuxHYa9NdVBsd5jUu/GPEJIgOIGY5HnY9iHW9oIL7fpKW2JEj kvbyiCCqYhh8aSuEkooP+VfGd9Z62zZ0KN41QW6Ksc2VeTXrX2reLvFvf0ncv3h3cjoG 6PAQ== X-Received: by 10.50.170.102 with SMTP id al6mr2787733igc.20.1362844991519; Sat, 09 Mar 2013 08:03:11 -0800 (PST) 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 qn10sm4302564igc.6.2013.03.09.08.03.09 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 09 Mar 2013 08:03:10 -0800 (PST) Message-ID: <513B5D3D.6020200@inktank.com> Date: Sat, 09 Mar 2013 10:03:09 -0600 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130221 Thunderbird/17.0.3 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org Subject: [PATCH 4/7] ceph: only set message data pointers if non-empty References: <513B5CAF.4010702@inktank.com> In-Reply-To: <513B5CAF.4010702@inktank.com> X-Gm-Message-State: ALoCoQmN6n0cFfPTk6I+hjJr2+DcfoUEb0Pm6I1r05yNijHg/3OVXNzY2s2WJbAPcpXbikDv4cIO Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Change it so we only assign outgoing data information for messages if there is outgoing data to send. This then allows us to add a few more (currently commented-out) assertions. This is related to: http://tracker.ceph.com/issues/4284 Signed-off-by: Alex Elder Reviewed-by: Greg Farnum --- fs/ceph/mds_client.c | 13 ++++++++++--- net/ceph/messenger.c | 4 ++++ net/ceph/osd_client.c | 9 ++++++--- 3 files changed, 20 insertions(+), 6 deletions(-) ceph_msg_data_set_bio(req->r_request, osd_data->bio); @@ -1768,7 +1770,8 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc, } else { BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_NONE); } - ceph_msg_data_set_trail(req->r_request, &req->r_trail); + if (req->r_trail.length) + ceph_msg_data_set_trail(req->r_request, &req->r_trail); register_request(osdc, req); diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index ae9438f..4bef0ab 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -1721,7 +1721,11 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc, msg->front.iov_len = p - msg->front.iov_base; msg->hdr.front_len = cpu_to_le32(msg->front.iov_len); - ceph_msg_data_set_pages(msg, req->r_pages, req->r_data_len, 0); + if (req->r_data_len) { + /* outbound data set only by ceph_sync_setxattr() */ + BUG_ON(!req->r_pages); + ceph_msg_data_set_pages(msg, req->r_pages, req->r_data_len, 0); + } msg->hdr.data_len = cpu_to_le32(req->r_data_len); msg->hdr.data_off = cpu_to_le16(0); @@ -2603,10 +2607,13 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc, goto fail; } - ceph_msg_data_set_pagelist(reply, pagelist); if (recon_state.flock) reply->hdr.version = cpu_to_le16(2); - reply->hdr.data_len = cpu_to_le32(pagelist->length); + if (pagelist->length) { + /* set up outbound data if we have any */ + reply->hdr.data_len = cpu_to_le32(pagelist->length); + ceph_msg_data_set_pagelist(reply, pagelist); + } ceph_con_send(&session->s_con, reply); mutex_unlock(&session->s_mutex); diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index d118353..1965d78 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -2692,6 +2692,8 @@ EXPORT_SYMBOL(ceph_con_keepalive); void ceph_msg_data_set_pages(struct ceph_msg *msg, struct page **pages, size_t length, size_t alignment) { + /* BUG_ON(!pages); */ + /* BUG_ON(!length); */ /* BUG_ON(msg->pages); */ /* BUG_ON(msg->page_count); */ @@ -2705,6 +2707,7 @@ void ceph_msg_data_set_pagelist(struct ceph_msg *msg, struct ceph_pagelist *pagelist) { /* BUG_ON(!pagelist); */ + /* BUG_ON(!pagelist->length); */ /* BUG_ON(msg->pagelist); */ msg->pagelist = pagelist; @@ -2723,6 +2726,7 @@ EXPORT_SYMBOL(ceph_msg_data_set_bio); void ceph_msg_data_set_trail(struct ceph_msg *msg, struct ceph_pagelist *trail) { /* BUG_ON(!trail); */ + /* BUG_ON(!trail->length); */ /* BUG_ON(msg->trail); */ msg->trail = trail; diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 387e312..4402e91 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -1759,8 +1759,10 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc, osd_data = &req->r_data_out; if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGES) { BUG_ON(osd_data->length > (u64) SIZE_MAX); - ceph_msg_data_set_pages(req->r_request, osd_data->pages, - osd_data->length, osd_data->alignment); + if (osd_data->length) + ceph_msg_data_set_pages(req->r_request, + osd_data->pages, osd_data->length, + osd_data->alignment); #ifdef CONFIG_BLOCK } else if (osd_data->type == CEPH_OSD_DATA_TYPE_BIO) {