From patchwork Fri Jul 28 12:41:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 9868693 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D80D06037D for ; Fri, 28 Jul 2017 12:47:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D34C4288BF for ; Fri, 28 Jul 2017 12:47:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4347288C7; Fri, 28 Jul 2017 12:47:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5EF42288BF for ; Fri, 28 Jul 2017 12:47:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751887AbdG1Mri (ORCPT ); Fri, 28 Jul 2017 08:47:38 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36073 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673AbdG1Mrh (ORCPT ); Fri, 28 Jul 2017 08:47:37 -0400 Received: by mail-wm0-f68.google.com with SMTP id 184so27304447wmo.3 for ; Fri, 28 Jul 2017 05:47:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=dQn/yxJXzdz9ndWAr2/klOx6q88wYMVMpF/LnoYC3ME=; b=G3wwzswlJ3gVERPG+ap3/nD+Jlhf/uzwKGsODdWpy9h5RzNqtECIAy9tye2I2trXDF MP7bVJ/Cjv4GAlRgmHBEx6kc81eBE/OSztb0APwdLZ+KP1CJhoDcTz3rrcpd32ieGH2W sUkEOvvJwhMsVem71UJTfAC3bVroSTsDVv07erup8Ad+rPJr9jpeV9dfygXcLKTKk8wb fZtjd+975ucn0zsAB/N4qKfg8j1D7jsoSUBXVXZjh6TBdWj09jt7Pvn1bkDL0IHE1UIE 3mO7z3MbH7eUO/x2NoC6SVdHxYNBC07yItp3IVTVPJmT5wkI4hOOO2+04X4+NG63RrRV Q4qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=dQn/yxJXzdz9ndWAr2/klOx6q88wYMVMpF/LnoYC3ME=; b=Vr20N/by+3+pGUcwphG4FNNEIXUJY0F5qmKxt8Zk0oMAfEhmZ41sTAcPEJZ2eEiEGJ w0OjWnynlmJn0w2rCllMa5cp/L4ht2g4hpzMlpfII4jvwz+2Xa5RMyV2aFMK0SPef5rn KyidvD9Xsxrg3VQx4v1xaw3GxZZCJ1sHfPXwHKTaucJpuCMuzQMaBotc9+ZoLHLowD19 SoHM4F9UcQ02TjUvtajznQHRBkOyqbuRC8up7XJLlLbATDPu/ujAqbb81rgmqrrMkt/+ wmmj5N9SuY596NDnzc4zkwgpQFkdGZTLSCpx/UvPuKG1iYw2xldG39ilQ4QwmpDx96rL 4p1Q== X-Gm-Message-State: AIVw113UDYrZWD02p2Ftv1U4Fp906p0V/IuXy2H6Dd2N/i100H9qmZh0 QJQvtqw/IY0n0M3ak+c= X-Received: by 10.28.68.85 with SMTP id r82mr5438520wma.21.1501245700361; Fri, 28 Jul 2017 05:41:40 -0700 (PDT) Received: from orange.brq.redhat.com. (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id c13sm8263773wrc.7.2017.07.28.05.41.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jul 2017 05:41:39 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Subject: [PATCH 2/6] libceph: don't call ->reencode_message() more than once per message Date: Fri, 28 Jul 2017 14:41:26 +0200 Message-Id: <1501245690-2362-3-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1501245690-2362-1-git-send-email-idryomov@gmail.com> References: <1501245690-2362-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-Virus-Scanned: ClamAV using ClamSMTP Reencoding an already reencoded message is a bad idea. This could happen on Policy::stateful_server connections (!CEPH_MSG_CONNECT_LOSSY), such as MDS sessions. This didn't pop up in testing because currently only OSD requests are reencoded and OSD sessions are always lossy. Fixes: 98ad5ebd1505 ("libceph: ceph_connection_operations::reencode_message() method") Signed-off-by: Ilya Dryomov Reviewed-by: "Yan, Zheng" --- net/ceph/messenger.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index b7cc615d42ef..a67298c7e0cd 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -1287,10 +1287,10 @@ static void prepare_write_message(struct ceph_connection *con) if (m->needs_out_seq) { m->hdr.seq = cpu_to_le64(++con->out_seq); m->needs_out_seq = false; - } - if (con->ops->reencode_message) - con->ops->reencode_message(m); + if (con->ops->reencode_message) + con->ops->reencode_message(m); + } dout("prepare_write_message %p seq %lld type %d len %d+%d+%zd\n", m, con->out_seq, le16_to_cpu(m->hdr.type),