From patchwork Tue Jul 4 07:55:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 9824259 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 7F27F60237 for ; Tue, 4 Jul 2017 07:56:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 716F427FB0 for ; Tue, 4 Jul 2017 07:56:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6654D2842B; Tue, 4 Jul 2017 07:56: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=-5.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, URIBL_BLACK 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 CAB1E27FB0 for ; Tue, 4 Jul 2017 07:56:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752264AbdGDH4N (ORCPT ); Tue, 4 Jul 2017 03:56:13 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:53834 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752260AbdGDH4M (ORCPT ); Tue, 4 Jul 2017 03:56:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=2kGgfCN+j1HeTy1/oC0qIaoHU4N7+0Urw2E9j6JeBPE=; b=JHq7iOKFPr2yjxHmwMoMfjSX4 816pBas+owaPIwRZIYBPBgn+cVySjobLzZFyIGrn92BM2tVuV9K+0wtLaFr3ehMTnRQGKSrR0UT32 1Da4FHoXqfG1G6tVTQfOpESlsWAEKZgThFuqKhFvQ0Jgpy6vLJLf3ODSBrxR8m6CCZb8Hy0bj1lU2 VkfB2DzxHtVDidIvvrw9PLMMB/+UkmMSUCMMECsOrhVt+Gyb8Y+8EXABFheh0ASMzcmB3kaxOQ66m LyfdrrVrfXufOhALhs9jSUOFY7Q/wpOSBbvipl68bcJMlAVCZ1MXxRmliAnZ5agDFOGXHauowatEx Yxj+dU3Uw==; Received: from bzq-82-81-101-184.red.bezeqint.net ([82.81.101.184] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1dSIgs-0001E3-6W; Tue, 04 Jul 2017 07:56:11 +0000 From: Sagi Grimberg To: Jens Axboe , linux-block@vger.kernel.org, linux-nvme@lists.infradead.org Cc: Christoph Hellwig , Keith Busch , Josef Bacik Subject: [PATCH 5/8] nbd: quiesce request queues to make sure no submissions are inflight Date: Tue, 4 Jul 2017 10:55:09 +0300 Message-Id: <1499154912-10420-6-git-send-email-sagi@grimberg.me> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499154912-10420-1-git-send-email-sagi@grimberg.me> References: <1499154912-10420-1-git-send-email-sagi@grimberg.me> 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 We must make sure that no requests are being queued before we iterate over the tags. quiesce/unquiesce the request queue istead of start/stop hw queues. Cc: Josef Bacik Signed-off-by: Sagi Grimberg Reviewed-by: Ming Lei --- drivers/block/nbd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 977ec960dd2f..dea7d85134ee 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -661,9 +661,9 @@ static void nbd_clear_req(struct request *req, void *data, bool reserved) static void nbd_clear_que(struct nbd_device *nbd) { - blk_mq_stop_hw_queues(nbd->disk->queue); + blk_mq_quiesce_queue(nbd->disk->queue); blk_mq_tagset_busy_iter(&nbd->tag_set, nbd_clear_req, NULL); - blk_mq_start_hw_queues(nbd->disk->queue); + blk_mq_unquiesce_queue(nbd->disk->queue); dev_dbg(disk_to_dev(nbd->disk), "queue cleared\n"); }