From patchwork Fri Apr 13 16:03:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10340363 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 75D3E60329 for ; Fri, 13 Apr 2018 16:03:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E0FA1FFDA for ; Fri, 13 Apr 2018 16:03:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6271620499; Fri, 13 Apr 2018 16:03:42 +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 0A18A1FFDA for ; Fri, 13 Apr 2018 16:03:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752499AbeDMQDl (ORCPT ); Fri, 13 Apr 2018 12:03:41 -0400 Received: from mail-qk0-f196.google.com ([209.85.220.196]:44944 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752498AbeDMQDj (ORCPT ); Fri, 13 Apr 2018 12:03:39 -0400 Received: by mail-qk0-f196.google.com with SMTP id n139so9614009qke.11 for ; Fri, 13 Apr 2018 09:03:39 -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=HAowlpRptmikqOiFs3jbd3nvY+HrxUrtT2KKSCXo6j0=; b=lUFbfaSEHap4bWn0P9bfMTfgYVA4g0PW/IFKaMHk2Vr3xbBbsx2cyscMxodzl/YxbA eYPG4sjmneMoXM9Z3J0tON7Zujzn1v7o3WrAygmsdB37XM261t/xvJ902q7EDaWdppoM uIaxj/mjDH3zmfhc2cpmWLGgYPj75KMzlWh8NADvy7U648CrQAk7S74RfDLAl48+54xK OcUZBXCYG0KvSrYpqTj1x1pyNZUvdFOiCi2po6q/TqV1CN5dHYMAbjMSeGK0vWTR0f1R aH3sEfUbRlFlZPpecTdgMWmL/+xK7BdBo42fkDfGOsYatvA/RhtRg985w2vXvvZ433Hf 79IQ== 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=HAowlpRptmikqOiFs3jbd3nvY+HrxUrtT2KKSCXo6j0=; b=C5aQwYvY6MVUA26klllmDfO2wfj3s4pO14C6mklCpWDeXInbxUp4ZPsLgE7kPUQxp9 B9qlbPipCoNZLH5X6ffHxtQRUV/9jVQjRkA0mVxRVyP+BDRzn8359HwUq2QcYi1cru1W mFByWvJwB66RodbHX1ECovJMqyl9h5ruCFDEAv4bNUb8dskMmQbcBgnVAIFlPSxeEu47 /fg0f4IP1y7wyx3UFbmLyPGU17+HqnNgttpTfVvNHFuMCK7inI9v6enCfNbOjxSSF1zC fd4DZNlUfUl/ZzwShAeRdGdegglSDwk1KAsXVLDOGu0kKoK9wiLGlsWK4ryFGURIRF/F Vqkg== X-Gm-Message-State: ALQs6tDkfXx4qiro9gjBDK29fR92+6ZCtPdQk8r51DAyxFYA8cZCA5uf WFDY1FJdAPngkUIOnLmpA2bsvw== X-Google-Smtp-Source: AIpwx49+KZuAxosjcT8q7qLIGmnFfp5Wr0ql0iO7YCSrsdOgNu0XjsJGvVJWRe+7i/n6uTIc2nNYTA== X-Received: by 10.55.142.196 with SMTP id q187mr4914383qkd.149.1523635419155; Fri, 13 Apr 2018 09:03:39 -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 g23sm5253661qta.78.2018.04.13.09.03.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Apr 2018 09:03:38 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, nbd@other.debian.org, linux-block@vger.kernel.org, kernel-team@fb.com, alex@iss-integration.com Cc: Josef Bacik , stable@vger.kernel.org Subject: [PATCH 3/3] nbd: use bd_set_size when updating disk size Date: Fri, 13 Apr 2018 12:03:34 -0400 Message-Id: <20180413160334.5496-3-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180413160334.5496-1-josef@toxicpanda.com> References: <20180413160334.5496-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 When we stopped relying on the bdev everywhere I broke updating the block device size on the fly, which ceph relies on. We can't just do set_capacity, we also have to do bd_set_size so things like parted will notice the device size change. Fixes: 29eaadc ("nbd: stop using the bdev everywhere") cc: stable@vger.kernel.org Signed-off-by: Josef Bacik --- drivers/block/nbd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 1520383b12f6..61dd95aa47fa 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -231,9 +231,15 @@ static void nbd_size_clear(struct nbd_device *nbd) static void nbd_size_update(struct nbd_device *nbd) { struct nbd_config *config = nbd->config; + struct block_device *bdev = bdget_disk(nbd->disk, 0); + blk_queue_logical_block_size(nbd->disk->queue, config->blksize); blk_queue_physical_block_size(nbd->disk->queue, config->blksize); set_capacity(nbd->disk, config->bytesize >> 9); + if (bdev) { + bd_set_size(bdev, config->bytesize); + bdput(bdev); + } kobject_uevent(&nbd_to_dev(nbd)->kobj, KOBJ_CHANGE); } @@ -1111,7 +1117,6 @@ static int nbd_start_device_ioctl(struct nbd_device *nbd, struct block_device *b if (ret) return ret; - bd_set_size(bdev, config->bytesize); if (max_part) bdev->bd_invalidated = 1; mutex_unlock(&nbd->config_lock);