From patchwork Mon Oct 9 17:12:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9993963 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 CD1CE602D7 for ; Mon, 9 Oct 2017 17:12:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B64F92871C for ; Mon, 9 Oct 2017 17:12:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB1B8287C3; Mon, 9 Oct 2017 17:12:14 +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.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 3AFE42871C for ; Mon, 9 Oct 2017 17:12:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754234AbdJIRMN (ORCPT ); Mon, 9 Oct 2017 13:12:13 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:55123 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751896AbdJIRMM (ORCPT ); Mon, 9 Oct 2017 13:12:12 -0400 Received: by mail-qt0-f195.google.com with SMTP id i13so44415387qtc.11 for ; Mon, 09 Oct 2017 10:12:12 -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=C/bJXpNRVUg92DutI4J9dvt81ICozAMR73s1lWwC0BA=; b=WXvpveNYKu80c3ldvc99lfAz94PGXul1j7q4rR6aNTiNN/rZ3czrBFSl9miOrHOY2P HRAP+VbUqVuq72dH0VJL1jhFySabqaF7jba1oagrtV93ZCKaUMPw9GWK3/bDHQtjqj+E mm4ukLZ8uZN84stpMsSfLdeAcUxqhnU5T0zZ4Je6cA//L/f4x03A+IG/0Td67kI8vwsu wCfZw7sZn6F2BcblLkMebWiOVFiF/l3xvGfvkSV1Jcfk3/zQAqDItRp8a/CQEV1x8RKP Ma7jPpB+ZobAKSSgVBX3a9S4jDvJ2vrR1t9l9wUMwGdyZqpp+ZotUjTCjc1ctCqr3mrU M8Dg== 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=C/bJXpNRVUg92DutI4J9dvt81ICozAMR73s1lWwC0BA=; b=A50+0vRpyyOYvAH7ZuwrcyJheOoOpM/iCxUmUBH49sgQCJ9+uv3EBGrTdH6rGAfDQV +zqp6kPnNwW3NzrJg9r5OybgWQpBBAMRhDbIq0tKsJ6qUCXip8P6PclaJW8p48TxhMUM l8qjCzkuRccZIHQ3fUyr+GTPXOEivQXbLFUvRx59AfvjAXjV2GvQxCun64mrLy60jfhs LAaY0iBQuPfzjjNSSyzisZCZltpJKVyGzONgqEyOFMFdEZ/I3xwKKqfkmyIKMkLJ3Rx5 pc693ac02jTUuuLDyy5td5jnW8XKxbotCVG9IvHM6ihxf6TnBl9wKysHWMFwwg60AEhm T43Q== X-Gm-Message-State: AMCzsaVIrbJM7XfNJr9gAYrEq9pcc3C2Ob7KAo8rfcBgJlRUOWFqg4mU cCjsUizlsFMNzCok1MeqSER63g== X-Google-Smtp-Source: AOwi7QA2I/7TwKNhVBfIt+dwl0wBQRLPknimU+B2uH5Pr+xeVRejN5i6jgkhYSMaCghnZovBMuNrTg== X-Received: by 10.200.52.149 with SMTP id w21mr8818710qtb.75.1507569131602; Mon, 09 Oct 2017 10:12:11 -0700 (PDT) Received: from localhost ([2606:a000:4381:1201:225:22ff:feb3:e51a]) by smtp.gmail.com with ESMTPSA id 36sm5264698qtr.42.2017.10.09.10.12.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Oct 2017 10:12:10 -0700 (PDT) From: Josef Bacik X-Google-Original-From: Josef Bacik To: axboe@kernel.dk, nbd-general@lists.sourceforge.net, linux-block@vger.kernel.org, kernel-team@fb.com Cc: stable@vger.kernel.org Subject: [PATCH] nbd: don't set the device size until we're connected Date: Mon, 9 Oct 2017 13:12:10 -0400 Message-Id: <1507569130-5067-1-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.7.4 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 A user reported a regression with using the normal ioctl interface on newer kernels. This happens because I was setting the device size before the device was actually connected, which caused us to error out and close everything down. This didn't happen on netlink because we hold the device lock the whole time we're setting things up, but we don't do that for the ioctl path. This fixes the problem. Cc: stable@vger.kernel.org Fixes: 29eaadc ("nbd: stop using the bdev everywhere") 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 883dfeb..baebbdf 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -243,7 +243,6 @@ 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; - nbd_size_update(nbd); } static void nbd_complete_rq(struct request *req) @@ -1094,6 +1093,7 @@ static int nbd_start_device(struct nbd_device *nbd) args->index = i; queue_work(recv_workqueue, &args->work); } + nbd_size_update(nbd); return error; }