From patchwork Fri Jul 28 12:41:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 9868683 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 B9D8F6038F for ; Fri, 28 Jul 2017 12:41:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B67D5288BB for ; Fri, 28 Jul 2017 12:41:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9363288BE; Fri, 28 Jul 2017 12:41:54 +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 6275E288BB for ; Fri, 28 Jul 2017 12:41:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751956AbdG1Mlp (ORCPT ); Fri, 28 Jul 2017 08:41:45 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33393 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751936AbdG1Mln (ORCPT ); Fri, 28 Jul 2017 08:41:43 -0400 Received: by mail-wm0-f66.google.com with SMTP id q189so16146365wmd.0 for ; Fri, 28 Jul 2017 05:41:42 -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=hf4JY0OfErOvDbQXkuVe8qMl8KViadd/eVic6xrBnPE=; b=eZwj/Vhm93nxeslLagaB12SKdE9wsiPitN1r5vcej6BDkHwR7w7akIZ8ee4zXEQL5T mNMuXrSBQoc0daFOfxsO+3JujB9rzRruhEMLgTU8Z7KVUfnzW+srGY6OK0La8bnm3BJh kcQ6i8tba50//hYtTDFbcSFSmEfyo4eWuawR6v21uaoP9IQN4wOw7glPZrVJ4jWMK2hP gamQixLStqD0WluaMWHFpr7ysJ6MromMeC52lbg1HB1dARFBdHwA7OuWpScwJ0tTBtX+ L5dX/k1O/badNZu3DF8JwpEINawpHqBNUFYRLeJO33vxOIQ0DCR1Pv94Ig5OU+hhtODy vhzQ== 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=hf4JY0OfErOvDbQXkuVe8qMl8KViadd/eVic6xrBnPE=; b=SIW2A/D8hFleFPStJ4fUcuYdIgJgKrceTQ+yrqpXRvoKpmUasACVbobgb1z1gU3Wkd 2u8Buv1GTvtddW7i62pu5ka5Lc4xBZPrigV8I4T//SxjGRJL356tiCrnpe/za/od4bIE e4rNy8X4gOp/G9nf1Th+Xud8cxoA/8Z3s1jB07yphDTfmiYCM9x3EUNkLAE6iqI+/MCR 2b1w+oadUPSWLjQXrilltNGzNlC8Nm8lvQKi95OlTyaaCm4juvghkqBhO20qFunLHDgw jCTCpl0tWmE2BRaIa4dYGaLkaGoQOUOScqm0iWoFEYTQS3h+1z/k9TEDVObAP4O4ABjp x6xQ== X-Gm-Message-State: AIVw111wHixX76voJv3uT0J/Aduxdad3nIB3VByLQGXo+BV6usXCKn+L qwyUvPSNcX440/hyTi8= X-Received: by 10.28.23.195 with SMTP id 186mr5343961wmx.173.1501245701910; Fri, 28 Jul 2017 05:41:41 -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.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jul 2017 05:41:41 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Subject: [PATCH 4/6] crush: assume weight_set != null imples weight_set_size > 0 Date: Fri, 28 Jul 2017 14:41:28 +0200 Message-Id: <1501245690-2362-5-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 Reflects ceph.git commit 5e8fa3e06b68fae1582c9230a3a8d1abc6146286. Signed-off-by: Ilya Dryomov --- net/ceph/crush/mapper.c | 2 +- net/ceph/osdmap.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c index 746b145bfd11..417df675c71b 100644 --- a/net/ceph/crush/mapper.c +++ b/net/ceph/crush/mapper.c @@ -306,7 +306,7 @@ static __u32 *get_choose_arg_weights(const struct crush_bucket_straw2 *bucket, const struct crush_choose_arg *arg, int position) { - if (!arg || !arg->weight_set || arg->weight_set_size == 0) + if (!arg || !arg->weight_set) return bucket->item_weights; if (position >= arg->weight_set_size) diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index eb57a06373ca..2586e5546143 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c @@ -295,6 +295,10 @@ static int decode_choose_args(void **p, void *end, struct crush_map *c) ret = decode_choose_arg(p, end, arg); if (ret) goto fail; + + if (arg->ids_size && + arg->ids_size != c->buckets[bucket_index]->size) + goto e_inval; } insert_choose_arg_map(&c->choose_args, arg_map);