From patchwork Wed May 16 18:51:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10404671 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 97A77601F7 for ; Wed, 16 May 2018 18:51:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89D1928384 for ; Wed, 16 May 2018 18:51:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E9FC285E8; Wed, 16 May 2018 18:51:35 +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 33E9828384 for ; Wed, 16 May 2018 18:51:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751254AbeEPSve (ORCPT ); Wed, 16 May 2018 14:51:34 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:37975 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751130AbeEPSvd (ORCPT ); Wed, 16 May 2018 14:51:33 -0400 Received: by mail-qt0-f194.google.com with SMTP id m9-v6so2475112qtb.5 for ; Wed, 16 May 2018 11:51:33 -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=ze7KB1SrDFDe8yZ+JBxr6xuzoVQH1ypWNl/V8RU8t/M=; b=My3YfYLHJsNCvLEvnFiODU9d0yx+Yy5OZ5xT/1G5q37KN6e7VrsNQt067WuNk/Vw9O pxt9wn/4YeULxIUH78gHJgKh5PCz6bCH7zfEPn6pgceu7L2SrkNp33NbBlPySHg8cee+ b3ekY66HhlFwkCTlbnc0uLfyYF+SLDPyjuZ/OUnCnUpWPxz3uJKLYwmaVne2SC+R2EvK wVHpqgfZpbQ0+nCxZp7gW7zaCL13hhcOaRm65nmC+q39T1f7cCyP1UalptKQYDGVkDwr LklKgTJzWwYjOAxw0fDEjnZWbROlucLSrkYT1ZrXVEEy5lzlfio4RAxPF8J8/rwnpx75 IGkw== 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=ze7KB1SrDFDe8yZ+JBxr6xuzoVQH1ypWNl/V8RU8t/M=; b=q/Xj1usOhF93FEgApo/q4A1bBdJ83c/T2W/QFzAfwJcSYL7nCUfSNbhB2z73cd1zyN MBqQdBuDwVnW4iwZpsuHof2OX9sbh6oQLd34OE9UJKTj9g0Le/DJfUtO4MWkxKGP/owu Pq2/dog20awnepq5i/j6CrCusJOrMFl9SrZ3oafwuA3r+VSS4r6GuRk1tndg299OsnAD 51Zbx3sTuMfY+2lHkT4EOwqQ07cBFYxmlcdfjjGHod+8aNxh4cAANWQMn9FA4oHDndV8 6TkcJzyU7FacWbsfWzHapi67biLrc65gBcdFljnYWcHvZn0/v1D9A7F8d7gr3l2lZH0n /Zpw== X-Gm-Message-State: ALKqPwcySav/5sTB74hwMDGVbwu8pKcmcke6ty+qs7rsVggczl/EZ+Qm CqY2m47AAlaJ1zTuB/nJXD+jEA== X-Google-Smtp-Source: AB8JxZq2b0CdxsL75PYgo1BWFwGJ9u8uJUAbuhof5jJJBXEF26fFj3xw+Z5vR6E8KPUJEIHEudWoBg== X-Received: by 2002:a0c:d8c1:: with SMTP id w1-v6mr2233561qvj.40.1526496693015; Wed, 16 May 2018 11:51:33 -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 q8-v6sm2115649qtp.2.2018.05.16.11.51.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 11:51:32 -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 Subject: [PATCH 7/7] nbd: call nbd_bdev_reset instead of bd_set_size on disconnect Date: Wed, 16 May 2018 14:51:22 -0400 Message-Id: <20180516185122.18590-7-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 We need to make sure we don't just set the size of the bdev to 0 while it's being used by a file system. We have the appropriate check in nbd_bdev_reset, simply use that helper instead. Signed-off-by: Josef Bacik --- drivers/block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 24788bd10c8b..abc0a815354f 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -1127,7 +1127,7 @@ static int nbd_start_device_ioctl(struct nbd_device *nbd, struct block_device *b if (ret) sock_shutdown(nbd); mutex_lock(&nbd->config_lock); - bd_set_size(bdev, 0); + nbd_bdev_reset(bdev); /* user requested, ignore socket errors */ if (test_bit(NBD_DISCONNECT_REQUESTED, &config->runtime_flags)) ret = 0;