Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BD56C433EF for ; Fri, 25 Mar 2022 06:39:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346242AbiCYGlX (ORCPT ); Fri, 25 Mar 2022 02:41:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358467AbiCYGlU (ORCPT ); Fri, 25 Mar 2022 02:41:20 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACA20580C7 for ; Thu, 24 Mar 2022 23:39:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=GZoXaYyF7vEJO3Tu4Gtd0TaYRNuVudX60qmzVoPMimI=; b=eRzr4xdNNrKyrjzXNs4dzDIOa6 I1HYdNEP6UBHi9Th1ebhX+M+5iMryuPTociS5EDycWJvWaguE1A1nd/I7AQUhc0XPnVh5SpQbfx8W ZEGadEmp6h+UtGMDz4+NH9F4PrBvZ89vkim53AqTbfwqIjCZBlcv8vqhyVJVm1Ugs9b4WGZENDZ3k ptmMuAx33R8xUr3MHTHF3eqkwaMAstnjlMXTRGK5z1/5W1dNaCjku2rb+0QmYx/AthwcBSaCJB8Rd nxjnff7SYl0qM9qBthWYXF3XyMFi3idGl6NzXxoY1Vc2pvXMbG7bLAPIrS62eO58PHgDFhHLpHKcj oYieguxw==; Received: from 089144194144.atnat0003.highway.a1.net ([89.144.194.144] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nXdbh-001HFl-6C; Fri, 25 Mar 2022 06:39:34 +0000 From: Christoph Hellwig To: Jens Axboe , Josef Bacik , Minchan Kim , Nitin Gupta Cc: Tetsuo Handa , Jan Kara , "Darrick J . Wong" , Ming Lei , Matteo Croce , linux-block@vger.kernel.org, nbd@other.debian.org Subject: yet another approach to fix the loop lock order inversions v5 Date: Fri, 25 Mar 2022 07:39:15 +0100 Message-Id: <20220325063929.1773899-1-hch@lst.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Hi all, this series uses the approach from Tetsuo to delay the destroy_workueue call, extended by a delayed teardown of the workers to fix a potential race window then the workqueue can be still round after finishing the commands. Changes since v4: - keep the (questionable) __invalidate_device call in nbd as-is for now - suppress uevents while reconfiguring Changes since v3: - change bd_openers into a atomic_t, including a bunch of cleanups and fix found while adding those Changes since v2: - rebased to the lastest block for-next tree, which has the async clear reverted and ->free_disk - impkement ->free_disk for loop to handle open vs delete races more gracefully - get rid of lo_refcnt entirely Changes since v1: - add comments to document the lo_refcnt synchronization - fix comment typos