Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42776C63798 for ; Wed, 25 Nov 2020 16:45:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 01ED721527 for ; Wed, 25 Nov 2020 16:45:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730115AbgKYQpW (ORCPT ); Wed, 25 Nov 2020 11:45:22 -0500 Received: from verein.lst.de ([213.95.11.211]:59718 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732072AbgKYQpU (ORCPT ); Wed, 25 Nov 2020 11:45:20 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id 05B8968B02; Wed, 25 Nov 2020 17:45:16 +0100 (CET) Date: Wed, 25 Nov 2020 17:45:15 +0100 From: Christoph Hellwig To: Tejun Heo Cc: Christoph Hellwig , Jens Axboe , Josef Bacik , Konrad Rzeszutek Wilk , Coly Li , Mike Snitzer , Greg Kroah-Hartman , Jan Kara , Johannes Thumshirn , dm-devel@redhat.com, Richard Weinberger , Jan Kara , linux-block@vger.kernel.org, xen-devel@lists.xenproject.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 25/45] block: reference struct block_device from struct hd_struct Message-ID: <20201125164515.GB1975@lst.de> References: <20201124132751.3747337-1-hch@lst.de> <20201124132751.3747337-26-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-bcache@vger.kernel.org On Tue, Nov 24, 2020 at 04:18:49PM -0500, Tejun Heo wrote: > Hello, > > Please see lkml.kernel.org/r/X708BTJ5njtbC2z1@mtj.duckdns.org for a few nits > on the previous version. Thanks, I've addressed the mapping_set_gfp mask nit and updated the commit log. As Jan pointed also pointed out I think we do need the remove_inode_hash. > I might be confused but am wondering whether RCU is needed. It's currently > used to ensure that gendisk is accessible in the blkdev_get path but > wouldn't it be possible to simply pin gendisk from block_devices? The > gendisk and hd_structs hold the base refs of the block_devices and in turn > the block_devices pin the gendisk. When the gendisk gets deleted, it puts > the base refs of the block devices but stays around while the block devices > are being accessed. Yes, that sounds sensible. I'll take a look. > Also, would it make sense to separate out lookup_sem removal? I *think* it's > there to ensure that the same bdev doesn't get associated with old and new > gendisks at the same time but can't wrap my head around how it works > exactly. I can see that this may not be needed once the lifetimes of gendisk > and block_devices are tied together but that may warrant a bit more > explanation. Jan added lookup_sem in commit 56c0908c855afbb to prevent a three way race between del_gendisk and blkdev_open due to the weird bdev vs gendisk lifetime rules. None of that can happen with the new lookup scheme.