Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1422072pxa; Sun, 23 Aug 2020 02:13:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVvN+CZzegbiQUSnVwyAtrscM11JXVMqd3DPJ4KKRB2v0EPWsa9l2Ko92Yw/EZ9dRiVPZY X-Received: by 2002:a17:906:1756:: with SMTP id d22mr736918eje.29.1598174018305; Sun, 23 Aug 2020 02:13:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598174018; cv=none; d=google.com; s=arc-20160816; b=EKARYneIln+xFYgVNpr1bBOY8WBGGZpZIiKLTToN86r6jUS5ZlyeS87LSYCqXZSKzg h8fNwycTVS+xHA6o913mhwFF4A1DUTKJFzI/DyG8umt5kQ8aFv1nQv46U/TNdsMui1N5 jn2lRIh09AZJsOwNx4EY8Z0KAix9KAqvTJMU98gkzfIpSIwqPZmfcYwii0LGHcTvxuy4 ObtP10vHwEc/60WFwDVlxfDnHNTdLT8dscV6EJjs+M+Gg4gabsorWZH6mCtZ6Jrc3bV0 Cep7hS+RV8oNiZX4PBfp+1OSBKsI+wp/UIJNNcsFpyXcUOh3MF4ky8SI3IrCMFgU2hUY QW0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=No1/zNvYiAlQJ+2VM2KxEVKX9my3nDvRhpc7oRbGQdM=; b=UDLn3VhYI3a7wGJNMCx66HR9WQN1O0pa3mCXLBKalMi7NCCRGabKmMMJOSPmGE5VDw V07hwWGGWB3BIhFH5RpBiiLmkosVgr/glD+JmeFmLidexCZlTeKntEkjfNxwwJTiUY2r QwskMT3GFE4MKmWq5lSbWs5X4d+qYFmfvx9gv8BdLAd/nZT75FcvpkBFYHMFIVdP941E itGuNcUZ1JFWShkkLJOHL37lFFHDcz1FZl45+eBc7NNdNb2TcMUnstFKk9MK2VA8ybc8 9m0krf1w1fFOgqf/69bYrnP7tRvprYpvD4Fggwz94dJ0DQiaMUjuCijil/a6FQNXzRkW J7sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=j1K8V7pl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t14si4842031ejb.435.2020.08.23.02.13.14; Sun, 23 Aug 2020 02:13:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=j1K8V7pl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726782AbgHWJLK (ORCPT + 99 others); Sun, 23 Aug 2020 05:11:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725913AbgHWJLA (ORCPT ); Sun, 23 Aug 2020 05:11:00 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11941C061575; Sun, 23 Aug 2020 02:10:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=No1/zNvYiAlQJ+2VM2KxEVKX9my3nDvRhpc7oRbGQdM=; b=j1K8V7plEOJeLPtvyxOs4Di0MB K/7b31MHvupcxYapWHKr1a0hx0nGDI6xZzN3XPcorEnvGv+Zd2hvS+dCLU05yaqKrDDzeFTm/4DtO upJ2qqAS7pLLSDzPsXlNqdj7D7Pc2xnMJCelkfwXxsJS21cH28KDhnBzkZGZGSwUwyHELrP7eZ6KM XOhkPG5Ftewq53mD+aBu0fTnMQD92wLWJFth+fzWO/WjGpN2OvwA8bBehgXFghsezlndydOr9WziI 0j7oIrogrtZKa145H/tfv5KlcfSijH1M0kuxuZKyAyvozqf7s3ukgjpNbDng+n1qyEzvWz+45tV7+ Ot/nIsDQ==; Received: from 171.168.43.195.cust.ip.kpnqwest.it ([195.43.168.171] helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9m1U-0003KT-Cw; Sun, 23 Aug 2020 09:10:44 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Justin Sanders , Josef Bacik , Xianting Tian , linux-block@vger.kernel.org, dm-devel@redhat.com, Stefan Haberland , Jan Hoeppner , linux-kernel@vger.kernel.org, nbd@other.debian.org, linux-nvme@lists.infradead.org, linux-s390@vger.kernel.org Subject: fix block device size update serialization v2 Date: Sun, 23 Aug 2020 11:10:40 +0200 Message-Id: <20200823091043.2600261-1-hch@lst.de> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jens, this series fixes how we update i_size for the block device inodes (and thus the block device). Different helpers use two different locks (bd_mutex and i_rwsem) to protect the update, and it appears device mapper uses yet another internal lock. A lot of the drivers do the update handcrafted in often crufty ways. And in addition to that mess it turns out that the "main" lock, bd_mutex is pretty dead lock prone vs other spots in the block layer that acquire it during revalidation operations, as reported by Xianting. Fix all that by adding a dedicated spinlock just for the size updates. Changes since v1: - don't call __invalidate_device under the new spinlock - don't call into the file system code from the nvme removal code