From patchwork Wed May 16 18:51: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: 10404663 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 D8836602C2 for ; Wed, 16 May 2018 18:51:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C853728384 for ; Wed, 16 May 2018 18:51:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BCA8A285E8; Wed, 16 May 2018 18:51:30 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, 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 6FA9228384 for ; Wed, 16 May 2018 18:51:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751150AbeEPSv3 (ORCPT ); Wed, 16 May 2018 14:51:29 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:44637 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750937AbeEPSv2 (ORCPT ); Wed, 16 May 2018 14:51:28 -0400 Received: by mail-qt0-f195.google.com with SMTP id d3-v6so2465468qtp.11 for ; Wed, 16 May 2018 11:51:27 -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:in-reply-to:references; bh=wUOPXAiqwnvOvo7KCVJdWwPyayXAefH8viV9TZbwslA=; b=nwHrt4noC7TCO2v846FcZKNN4t8WnhkyvWvH3bW9IyJIYXT3VOL65ABYd0cs2JZg5z dP12HHm1ljjeA4hlkzCvCQj7SocGqkmTTrmgDun8Bwdv3pwdFPnongRLy4Gwfi9tlwcG qFEOsVUBjbuh5yBKucZ15eOzjyJATZiXwqvzxKQS8/TIT8jByBj8b0IZPNrsbBraTU+K 9f3yMVI9UWNfFTCDC8WRkXwuMplTFoRxJEnw3XJOaSqsO+NCFTmMQcJZ3epxhUdW+mtL 6bIbz14pVoeoD6N4fyehlr2hywfuhuR/4WhrWUvyGizuIyqwRKLyLNufTwegTWigQfp1 Lm3w== 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:in-reply-to :references; bh=wUOPXAiqwnvOvo7KCVJdWwPyayXAefH8viV9TZbwslA=; b=JolTLjHtRXLzavKwPVX7rI68CQ9VcATjJuGj7xmaBBN1zJ/1M614BLYymCRo9EVYDm 3T0amuvw1ZQOJVIS7WxhSwWFSOcoxxWOivqk9i99RUPLLI0JLsuyt45SMolBXQ9f1RB4 nKOx9RZOyQufv1xbhkyPguZU5axcbL5N+O7vzT43sA9VRWYqXn+ahCTdQqdil4KazSY6 xURPCLiv6Lr19P8ISB1Yk5JHXfsqMTL4/BgnPBzJyt3aPsy94iMTAwQp0joFHwLtQWyP rst2xX+SZYnlzWGEwz+8zpzz9sUQCzWT3b4plv39XjbY5v5b1YYHU3qYuMbTI0JJJO8+ Zo+Q== X-Gm-Message-State: ALKqPwcgpXnY3dX7gSPunxMWMYhdIV1IUjEGIy7QJUFBJMwghpTHLEYa Q0+tMOEXOzVXiiaBAl8Bg9sRhg== X-Google-Smtp-Source: AB8JxZpdnBkXe4d1x2jPjOuwoaL4Qc8+KuGf/4GVx0gUj/Jq4yudmVouzW6tY2Cb4CZW5MQPOXq66Q== X-Received: by 2002:a0c:c90b:: with SMTP id r11-v6mr2202415qvj.202.1526496687426; Wed, 16 May 2018 11:51:27 -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 z5-v6sm2391534qtb.88.2018.05.16.11.51.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 11:51:26 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, nbd@other.debian.org, linux-block@vger.kernel.org, kernel-team@fb.com Cc: Josef Bacik , stable@vger.kernel.org Subject: [PATCH 3/7] nbd: update size when connected Date: Wed, 16 May 2018 14:51:18 -0400 Message-Id: <20180516185122.18590-3-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180516185122.18590-1-josef@toxicpanda.com> References: <20180516185122.18590-1-josef@toxicpanda.com> 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 9710a0c338b0..b709abf3cb79 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -246,6 +246,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)