From patchwork Wed Sep 10 07:54:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 4874961 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C944A9F32E for ; Wed, 10 Sep 2014 07:54:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 069CD201BF for ; Wed, 10 Sep 2014 07:54:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4234F2018B for ; Wed, 10 Sep 2014 07:54:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751495AbaIJHyi (ORCPT ); Wed, 10 Sep 2014 03:54:38 -0400 Received: from mail-lb0-f170.google.com ([209.85.217.170]:42760 "EHLO mail-lb0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751283AbaIJHyi (ORCPT ); Wed, 10 Sep 2014 03:54:38 -0400 Received: by mail-lb0-f170.google.com with SMTP id u10so3796476lbd.29 for ; Wed, 10 Sep 2014 00:54:36 -0700 (PDT) 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=aQcUu2GEcJu2kJPGkHlGYMMZ8aZKItrN8/d0XzpeXe0=; b=i/7wlbGs2GIQuUzW7t+bnWxWjdcHOJ2x7L2TMe/DvmwcLLZ5j1C7WaIedeeQXjhmW2 ABr6VDFFkyvXbWr3h2vXGjIyoqPWuQV5NGnqfA5xWJToTVpCT0HcvNQBziKb/wCyrAtS s860cV9uMtJVq1a0OTAyNe6N2ExkPpbUF8w6+3LBb7szTWd9Ogz5McQNpFbrJYOVj59B EFwtW/6CJB8Hc/sN7aQPIv3MUFZpnsra8qu5/2i+J6yfTo7zEklxygYxNWdUmZB2RG0n qfZP6ybuqlRn99klE0ZNNiyGqfUQuR9srK7L0u6uFO3F1itSHQOb2GbZkoz9FpEcVoA6 FdXw== X-Gm-Message-State: ALoCoQmgywEtncXzGOziTGKbMGxQGuH94F3CPE4soVqW8PqdIsAgK/zmZ58R7iezUh7hFKi1hozD X-Received: by 10.112.219.71 with SMTP id pm7mr38513655lbc.3.1410335676767; Wed, 10 Sep 2014 00:54:36 -0700 (PDT) Received: from localhost ([109.110.67.183]) by mx.google.com with ESMTPSA id a2sm5361017lbg.19.2014.09.10.00.54.35 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 10 Sep 2014 00:54:36 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Cc: Sage Weil Subject: [PATCH 1/3] libceph: gracefully handle large reply messages from the mon Date: Wed, 10 Sep 2014 11:54:29 +0400 Message-Id: <1410335671-4581-2-git-send-email-ilya.dryomov@inktank.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1410335671-4581-1-git-send-email-ilya.dryomov@inktank.com> References: <1410335671-4581-1-git-send-email-ilya.dryomov@inktank.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=-9.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 From: Sage Weil We preallocate a few of the message types we get back from the mon. If we get a larger message than we are expecting, fall back to trying to allocate a new one instead of blindly using the one we have. CC: stable@vger.kernel.org Signed-off-by: Sage Weil Reviewed-by: --- net/ceph/mon_client.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c index 067d3af2eaf6..61fcfc304f68 100644 --- a/net/ceph/mon_client.c +++ b/net/ceph/mon_client.c @@ -1181,7 +1181,15 @@ static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con, if (!m) { pr_info("alloc_msg unknown type %d\n", type); *skip = 1; + } else if (front_len > m->front_alloc_len) { + pr_warning("mon_alloc_msg front %d > prealloc %d (%u#%llu)\n", + front_len, m->front_alloc_len, + (unsigned int)con->peer_name.type, + le64_to_cpu(con->peer_name.num)); + ceph_msg_put(m); + m = ceph_msg_new(type, front_len, GFP_NOFS, false); } + return m; }