From patchwork Wed Aug 1 19:03:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 10552827 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E6052A748 for ; Wed, 1 Aug 2018 19:04:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E59BC2BA07 for ; Wed, 1 Aug 2018 19:04:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA1182BAC7; Wed, 1 Aug 2018 19:04:20 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,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 2F65C2BAD0 for ; Wed, 1 Aug 2018 19:04:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387519AbeHAUva (ORCPT ); Wed, 1 Aug 2018 16:51:30 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:40188 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731900AbeHAUv3 (ORCPT ); Wed, 1 Aug 2018 16:51:29 -0400 Received: by mail-wr1-f66.google.com with SMTP id h15-v6so21136718wrs.7 for ; Wed, 01 Aug 2018 12:04:17 -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=TlkA72TOYOK++NwCO2uxxQK158WF78YEqAwbyTTfVU8=; b=uCyctozKaNkhNYDIu1JCKoiT8JACkDEgGal/+AInbsDBrvbpXIwuFLq1LqL63KQn5H +z1j66N+ThRv/BgtoU2Erzu+KzRGwOeXayzi3I85yQcSuAl5wkSlJVHHjJzzlciF1moe 3sXdG5pVoMHYubGDhCTwFwOCq6QFrYdOAjQPT27QMQJsKII6/fizDClLZuBWBltqxJe4 2dSFS7kRcC0jzyoAdDD8feFTP3+tMZxOY00VYiQFl3iVZ4r0fFwOVBZqT/s08sD4Q2Sa Y1haAsk7dM3Mb7e2EBnvfQqJOGXceT8Qsy6rvXZ0VIYbC0aw9G8ezUg+H286ox+jNr+u 6Pcg== 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=TlkA72TOYOK++NwCO2uxxQK158WF78YEqAwbyTTfVU8=; b=SXiKKo0ro78u/KmSSTgN0nKQltcrUhzrH1VlEmC3NRSj64qGLTdFVa3rN+cFOG5BDa rK93rRkiOH1r7mjmttPFi+Wq1EUq1KwJWP0S+XmZO55pAHY9W5+kCB7QyH1nZYfAUDJU F2iO79yGsvYnNO2O3Sz0tbUrBQtR/3eHz/RuWBORTkaIsHXLzG6k5Dt7MYLsIT3AF8JC O7ffuxNKLg5Tp2E5yTkBTJ7Qh/K/L97eM4thX9eTnEhgN/e4u/acB8VBlPmDHh3/XQj8 3/8SRJc15fHXJLhsM/lYx5pE9Xzk+PCpc0n2HZJvV4MqSNWgaMOV+PU5NzYbSAjeQdzo 8mQg== X-Gm-Message-State: AOUpUlGRZaTzV9XIlo5Qrh7/K024fp7Tdu/rkmiKGCLLWmDc8wZxCc+3 JTjUQw+YHuR5OGnpv9HY8pqFJAUk X-Google-Smtp-Source: AAOMgpc2yITOJLZpu1UCq7SIexYjFv+qF4EinPHjWLQNv16IMUnejROhTdtFpCHbli2lPQbYrK8YvA== X-Received: by 2002:adf:90e9:: with SMTP id i96-v6mr26287726wri.146.1533150256968; Wed, 01 Aug 2018 12:04:16 -0700 (PDT) Received: from orange.redhat.com ([213.175.37.12]) by smtp.gmail.com with ESMTPSA id r17-v6sm15401322wrt.44.2018.08.01.12.04.15 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Aug 2018 12:04:16 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Subject: [PATCH 2/8] libceph: factor out __prepare_write_connect() Date: Wed, 1 Aug 2018 21:03:44 +0200 Message-Id: <20180801190350.857-3-idryomov@gmail.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180801190350.857-1-idryomov@gmail.com> References: <20180801190350.857-1-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 Will be used for sending ceph_msg_connect with an updated authorizer, after the server challenges the initial authorizer. Signed-off-by: Ilya Dryomov --- net/ceph/messenger.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index b6ebd2cc16a1..500cc3da586f 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -1469,6 +1469,17 @@ static void prepare_write_banner(struct ceph_connection *con) con_flag_set(con, CON_FLAG_WRITE_PENDING); } +static void __prepare_write_connect(struct ceph_connection *con) +{ + con_out_kvec_add(con, sizeof(con->out_connect), &con->out_connect); + if (con->auth) + con_out_kvec_add(con, con->auth->authorizer_buf_len, + con->auth->authorizer_buf); + + con->out_more = 0; + con_flag_set(con, CON_FLAG_WRITE_PENDING); +} + static int prepare_write_connect(struct ceph_connection *con) { unsigned int global_seq = get_global_seq(con->msgr, 0); @@ -1504,15 +1515,7 @@ static int prepare_write_connect(struct ceph_connection *con) if (ret) return ret; - con_out_kvec_add(con, sizeof (con->out_connect), - &con->out_connect); - if (con->auth) - con_out_kvec_add(con, con->auth->authorizer_buf_len, - con->auth->authorizer_buf); - - con->out_more = 0; - con_flag_set(con, CON_FLAG_WRITE_PENDING); - + __prepare_write_connect(con); return 0; }