From mboxrd@z Thu Jan 1 00:00:00 1970 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=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 547C6C64E7C for ; Fri, 27 Nov 2020 15:47:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A72B522228 for ; Fri, 27 Nov 2020 15:47:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A72B522228 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EC0106B005C; Fri, 27 Nov 2020 10:47:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E6EB16B006C; Fri, 27 Nov 2020 10:47:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D84786B006E; Fri, 27 Nov 2020 10:47:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0102.hostedemail.com [216.40.44.102]) by kanga.kvack.org (Postfix) with ESMTP id C25E36B005C for ; Fri, 27 Nov 2020 10:47:13 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 845993638 for ; Fri, 27 Nov 2020 15:47:13 +0000 (UTC) X-FDA: 77530627146.04.drop54_0411b8e27389 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 69721800BA87 for ; Fri, 27 Nov 2020 15:47:13 +0000 (UTC) X-HE-Tag: drop54_0411b8e27389 X-Filterd-Recvd-Size: 2152 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Fri, 27 Nov 2020 15:47:12 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id C6DB768B05; Fri, 27 Nov 2020 16:47:09 +0100 (CET) Date: Fri, 27 Nov 2020 16:47:09 +0100 From: Christoph Hellwig To: Jan Kara Cc: Christoph Hellwig , Jens Axboe , Tejun Heo , Josef Bacik , Coly Li , Mike Snitzer , Greg Kroah-Hartman , Johannes Thumshirn , dm-devel@redhat.com, Jan Kara , linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 43/44] block: merge struct block_device and struct hd_struct Message-ID: <20201127154709.GA8881@lst.de> References: <20201126130422.92945-1-hch@lst.de> <20201126130422.92945-44-hch@lst.de> <20201127131901.GE27162@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201127131901.GE27162@quack2.suse.cz> User-Agent: Mutt/1.5.17 (2007-11-01) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Nov 27, 2020 at 02:19:01PM +0100, Jan Kara wrote: > The percpu refcount is long gone after the series refactoring... True. > > @@ -939,13 +910,13 @@ void blk_request_module(dev_t devt) > > */ > > struct block_device *bdget_disk(struct gendisk *disk, int partno) > > { > > - struct hd_struct *part; > > struct block_device *bdev = NULL; > > > > - part = disk_get_part(disk, partno); > > - if (part) > > - bdev = bdget_part(part); > > - disk_put_part(part); > > + rcu_read_lock(); > > + bdev = __disk_get_part(disk, partno); > > + if (bdev) > > + bdgrab(bdev); > > Again I think you need to accommodate for bdgrab() returning NULL here when > we race with partition destruction... For that we need to allow bdgrab to return NULL first, but otherwise this seems like the right way.