From patchwork Mon Mar 12 16:00:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10276677 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 1DDDB603B5 for ; Mon, 12 Mar 2018 16:00:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1A5C28D2F for ; Mon, 12 Mar 2018 16:00:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EEDFB28CEA; Mon, 12 Mar 2018 16:00:27 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI 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 E131028E1D for ; Mon, 12 Mar 2018 16:00:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932664AbeCLQAW (ORCPT ); Mon, 12 Mar 2018 12:00:22 -0400 Received: from mail-qk0-f195.google.com ([209.85.220.195]:42798 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932425AbeCLQAU (ORCPT ); Mon, 12 Mar 2018 12:00:20 -0400 Received: by mail-qk0-f195.google.com with SMTP id b198so2785945qkg.9 for ; Mon, 12 Mar 2018 09:00:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=DQd5OxufidvahjOQsZYgU2grkKPBpbn7tS5iGWm9RTw=; b=mKXyYznf/H+buJUOMCYPFfTb0FVe00WYKPeKQ2fisC/spdoN0ruVVaYVT5jIOHZnwW SaFJGyaW1CUJikGzMhg5w9QEHNmGqaDUGr+Ks8n65q331aWE8GLD2Q9Ww4l4dbcuiKSJ FYGGxQEdrYwLCFM5CFp+99bWXi1kL2GeqY44BukXq/Emw4+gLPiUXBXJYv8wsOqeeAZb PTqMeZO8eAk+3zAmZNxoaqtsgHlhgPs4qdY7LPESBCUX0BG76WSpoWQ1lfjxh/i7FNjb DrZxDpepJEFo24ADVEO/be6K89xeF6ypLCZwhhckMJKpgNDeKXR1nw6i2OVnk19mGzv0 71bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=DQd5OxufidvahjOQsZYgU2grkKPBpbn7tS5iGWm9RTw=; b=IuT0rmjJArL/b0+v4Op8QwGRogz2fx3rk+/hKc85b4768VmCCWtcZmazbZpcFjXAE9 dbs4AKvmzt4PBKIWSYxy5jV0puILM7gyIsGRSJhHxrvvTDqti59WeOhYDdnMXU5bEumF X+2sWo12ofR7Aq+dLoaCsu+16wPB8H9gVJVn4Q1vYBgbJ/jZnajAhZd+7Vzbcs3o1k0b GxIelbT7Zb37siJy7no2fa91wAerk5OHci5GiamBM8SH0DlnWO/LkMP3oOYQwos1CJll eSFzHbDJEANVZHyMvG+ZqjfU10SlZJLkdWNPbBXb+qcl0zZjJ0kV+3rOAA7BElQoQc/C ShQA== X-Gm-Message-State: AElRT7EauJxx7m5sbhtaIDR5+snOao+LHO3VXhTpi8+PK+3UmGj+lKU1 HEiC1+zwPJ/m5iGqlXl6gf8OJDY7 X-Google-Smtp-Source: AG47ELsbrfY84r7CRT7N6TYsFIhCsR/YoVu43JmaVEVucx3rXmsoMzEkp1VRNEHlMcFOE5am3pHO8A== X-Received: by 10.55.88.69 with SMTP id m66mr11836769qkb.354.1520870420088; Mon, 12 Mar 2018 09:00:20 -0700 (PDT) Received: from localhost (cpe-2606-A000-4381-1201-225-22FF-FEB3-E51A.dyn6.twc.com. [2606:a000:4381:1201:225:22ff:feb3:e51a]) by smtp.gmail.com with ESMTPSA id l1sm5034444qkk.27.2018.03.12.09.00.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Mar 2018 09:00:19 -0700 (PDT) From: Josef Bacik To: linux-block@vger.kernel.org, nbd@other.debian.org, axboe@kernel.dk, alex@iss-integration.com Cc: Josef Bacik , stable@vger.kernel.org Subject: [PATCH] nbd: update size when connected Date: Mon, 12 Mar 2018 12:00:18 -0400 Message-Id: <20180312160018.30896-1-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Josef Bacik I messed up changing the size of an NBD device while it was connected by not actually updating the device or doing the uevent. Fix this by updating everything if we're connected and we change the size. cc: stable@vger.kernel.org Fixes: 639812a ("nbd: don't set the device size until we're connected") Signed-off-by: Josef Bacik --- drivers/block/nbd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 86258b00a1d4..7106b98a35fb 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -243,6 +243,8 @@ static void nbd_size_set(struct nbd_device *nbd, loff_t blocksize, struct nbd_config *config = nbd->config; config->blksize = blocksize; config->bytesize = blocksize * nr_blocks; + if (nbd->task_recv != NULL) + nbd_size_update(nbd); } static void nbd_complete_rq(struct request *req)