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,URIBL_BLOCKED,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 AE1F1C3E8C5 for ; Fri, 27 Nov 2020 17:30:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3096522250 for ; Fri, 27 Nov 2020 17:30:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3096522250 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 834F86B0068; Fri, 27 Nov 2020 12:30:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7E31E6B006C; Fri, 27 Nov 2020 12:30:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7208B6B006E; Fri, 27 Nov 2020 12:30:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0094.hostedemail.com [216.40.44.94]) by kanga.kvack.org (Postfix) with ESMTP id 5C4416B0068 for ; Fri, 27 Nov 2020 12:30:12 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 1D0531E02 for ; Fri, 27 Nov 2020 17:30:12 +0000 (UTC) X-FDA: 77530886664.14.flock84_36074d527389 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id ED9ED18229837 for ; Fri, 27 Nov 2020 17:30:11 +0000 (UTC) X-HE-Tag: flock84_36074d527389 X-Filterd-Recvd-Size: 2848 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Fri, 27 Nov 2020 17:30:11 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 5DF80ABD7; Fri, 27 Nov 2020 17:30:10 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 1DA451E1319; Fri, 27 Nov 2020 18:30:10 +0100 (CET) Date: Fri, 27 Nov 2020 18:30:10 +0100 From: Jan Kara To: Christoph Hellwig Cc: Jan Kara , 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 41/44] block: switch disk_part_iter_* to use a struct block_device Message-ID: <20201127173010.GB4276@quack2.suse.cz> References: <20201126130422.92945-1-hch@lst.de> <20201126130422.92945-42-hch@lst.de> <20201127125341.GD27162@quack2.suse.cz> <20201127152407.GA7115@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201127152407.GA7115@lst.de> User-Agent: Mutt/1.10.1 (2018-07-13) 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 27-11-20 16:24:07, Christoph Hellwig wrote: > On Fri, Nov 27, 2020 at 01:53:41PM +0100, Jan Kara wrote: > > On Thu 26-11-20 14:04:19, Christoph Hellwig wrote: > > > > There's: > > > > /* put the last partition */ > > disk_put_part(piter->part); > > piter->part = NULL; > > > > at the beginning of disk_part_iter_next() which also needs switching to > > bdput(), doesn't it? > > That is switched to call disk_part_iter_exit in patch 13. I see, sorry for the noise. > > > @@ -271,8 +271,7 @@ struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter) > > > piter->idx == 0)) > > > continue; > > > > > > - get_device(part_to_dev(part->bd_part)); > > > - piter->part = part->bd_part; > > > + piter->part = bdgrab(part); > > > > bdgrab() could return NULL if we are racing with delete_partition() so I > > think we need to take care of that. > > bdgrab never retuns NULL.. Ah, that's what I misunderstood. I was confusing bdgrab() with igrab(). igrab() can return NULL but bdgrab() uses ihold() and thus cannot return NULL. But for the lifetime rules to be safe, we should be indeed using igrab() and check for NULL return... Honza -- Jan Kara SUSE Labs, CR