From patchwork Sat Feb 20 16:45:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 8367041 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BD1B2C0553 for ; Sat, 20 Feb 2016 16:46:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ADB53202E6 for ; Sat, 20 Feb 2016 16:46:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CFC0E2010F for ; Sat, 20 Feb 2016 16:46:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757868AbcBTQqh (ORCPT ); Sat, 20 Feb 2016 11:46:37 -0500 Received: from mail-wm0-f41.google.com ([74.125.82.41]:36638 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757489AbcBTQp4 (ORCPT ); Sat, 20 Feb 2016 11:45:56 -0500 Received: by mail-wm0-f41.google.com with SMTP id g62so117116000wme.1 for ; Sat, 20 Feb 2016 08:45:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ihv6oZ131cBGFk3OfnLZbQit5XK/9ynucHtapiNeB64=; b=LcU1sISnIEPwTR5dzuDCribtrVe3x/PFuJ095jLxH9AK/Esw2t7xUGlglqFeO48Te4 Ym8jhrZ60fV0WdksKNgZi2TNRQvFNWkNJV+wVrqKKTC1q2zM5LzTValjh1BpfS7N8pWD GC5xHd5G8RDfma1XLmunH7SXhRkO1aASoEc+WgZm9BgpbsTEVLFs0BkYpExczSDw2BeG RMhOcSCfPQft7dEXeyxMZfNe4Vpbocjexggg38p/eW5NtVuSPaOuZwDBVfV9xKxudBU1 irmKoIvmzlGluim5YU5y6hFzTkxno1MrIkiSKNf7JH+he76JYvnT5FJB+dybSfurj6vm IC7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ihv6oZ131cBGFk3OfnLZbQit5XK/9ynucHtapiNeB64=; b=ipAlP+l4rh2mJtHeoc113847NSVLyM6NILtqFswscrb97bi6NAQdUw+7tUucOpQpUb 7EFVF9oHxJ3SxnZqLvG0GN+glu4TEj//yYivKISjfjaHRrnoyZZIBHOfcaUXsi1SPYVX X/Gd5pj5dZq94Moi0Lcgl0//elil7x/4DrMFA3LQ56S1CblPSkBysTOfGhPOZxBoPcRD j98xTFGDBWus3eYg7b35hR5/HunpRYBt9H01VMOVqnsNsjraju2vcu/IY9gfxwtjOf0I 1HslUU6ZyYFautNd3SjZ/H4vdEBaZAGGD6y2a12yI7ujQyGy//15mvkfPBwxUumcsO6V AaFg== X-Gm-Message-State: AG10YOQ7XNzniOmwQgrfNCZ+8g572gs0whyK6Jjq+FCceK92UGKYl0BNzy5rRMfsv7R5Cw== X-Received: by 10.28.72.197 with SMTP id v188mr3486467wma.34.1455986755656; Sat, 20 Feb 2016 08:45:55 -0800 (PST) Received: from dhcp-26-205.brq.redhat.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id e19sm12784798wmd.1.2016.02.20.08.45.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 Feb 2016 08:45:55 -0800 (PST) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Cc: Varada Kari Subject: [PATCH 2/4] libceph: use the right footer size when skipping a message Date: Sat, 20 Feb 2016 17:45:27 +0100 Message-Id: <1455986729-12544-3-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1455986729-12544-1-git-send-email-idryomov@gmail.com> References: <1455986729-12544-1-git-send-email-idryomov@gmail.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ceph_msg_footer is 21 bytes long, while ceph_msg_footer_old is only 13. Don't skip too much when CEPH_FEATURE_MSG_AUTH isn't negotiated. Cc: stable@vger.kernel.org # 3.19+ Signed-off-by: Ilya Dryomov Reviewed-by: Alex Elder --- net/ceph/messenger.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index fec20819a5ea..dd7c1b7f932b 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -2284,6 +2284,13 @@ static int read_partial_msg_data(struct ceph_connection *con) return 1; /* must return > 0 to indicate success */ } +static size_t sizeof_footer(struct ceph_connection *con) +{ + return (con->peer_features & CEPH_FEATURE_MSG_AUTH) ? + sizeof(struct ceph_msg_footer) : + sizeof(struct ceph_msg_footer_old); +} + /* * read (part of) a message. */ @@ -2335,7 +2342,7 @@ static int read_partial_message(struct ceph_connection *con) ceph_pr_addr(&con->peer_addr.in_addr), seq, con->in_seq + 1); con->in_base_pos = -front_len - middle_len - data_len - - sizeof(m->footer); + sizeof_footer(con); con->in_tag = CEPH_MSGR_TAG_READY; return 1; } else if ((s64)seq - (s64)con->in_seq > 1) { @@ -2360,7 +2367,7 @@ static int read_partial_message(struct ceph_connection *con) /* skip this message */ dout("alloc_msg said skip message\n"); con->in_base_pos = -front_len - middle_len - data_len - - sizeof(m->footer); + sizeof_footer(con); con->in_tag = CEPH_MSGR_TAG_READY; con->in_seq++; return 1; @@ -2402,11 +2409,7 @@ static int read_partial_message(struct ceph_connection *con) } /* footer */ - if (need_sign) - size = sizeof(m->footer); - else - size = sizeof(m->old_footer); - + size = sizeof_footer(con); end += size; ret = read_partial(con, end, size, &m->footer); if (ret <= 0)